Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Sema / attr-capabilities.cpp
blob5bae94edaa41fdfb0c7f1222e0fd43dd5544a377
1 // RUN: %clang_cc1 -fsyntax-only -Wthread-safety -verify %s
3 class __attribute__((shared_capability("mutex"))) Mutex {
4 public:
5 void func1() __attribute__((assert_capability(this)));
6 void func2() __attribute__((assert_capability(!this)));
8 const Mutex& operator!() const { return *this; }
9 };
11 class NotACapability {
12 public:
13 void func1() __attribute__((assert_capability(this))); // expected-warning {{'assert_capability' attribute requires arguments whose type is annotated with 'capability' attribute; type here is 'NotACapability *'}}
14 void func2() __attribute__((assert_capability(!this))); // expected-warning {{'assert_capability' attribute requires arguments whose type is annotated with 'capability' attribute; type here is 'bool'}}
16 const NotACapability& operator!() const { return *this; }