diff options
Diffstat (limited to 'clang/test/SemaCXX/warn-consumed-parsing.cpp')
-rw-r--r-- | clang/test/SemaCXX/warn-consumed-parsing.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/test/SemaCXX/warn-consumed-parsing.cpp b/clang/test/SemaCXX/warn-consumed-parsing.cpp index 4408dfc7d71..001fb866b89 100644 --- a/clang/test/SemaCXX/warn-consumed-parsing.cpp +++ b/clang/test/SemaCXX/warn-consumed-parsing.cpp @@ -1,9 +1,9 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wconsumed -std=c++11 %s #define CALLABLE_WHEN_UNCONSUMED __attribute__ ((callable_when_unconsumed)) -#define CONSUMABLE __attribute__ ((consumable)) +#define CONSUMABLE(state) __attribute__ ((consumable(state))) #define CONSUMES __attribute__ ((consumes)) -#define RETURN_TYPESTATE(State) __attribute__ ((return_typestate(State))) +#define RETURN_TYPESTATE(state) __attribute__ ((return_typestate(state))) #define TESTS_UNCONSUMED __attribute__ ((tests_unconsumed)) // FIXME: This test is here because the warning is issued by the Consumed @@ -25,15 +25,15 @@ class AttrTester0 { int var0 CONSUMES; // expected-warning {{'consumes' attribute only applies to methods}} int var1 TESTS_UNCONSUMED; // expected-warning {{'tests_unconsumed' attribute only applies to methods}} int var2 CALLABLE_WHEN_UNCONSUMED; // expected-warning {{'callable_when_unconsumed' attribute only applies to methods}} -int var3 CONSUMABLE; // expected-warning {{'consumable' attribute only applies to classes}} +int var3 CONSUMABLE(consumed); // expected-warning {{'consumable' attribute only applies to classes}} int var4 RETURN_TYPESTATE(consumed); // expected-warning {{'return_typestate' attribute only applies to functions}} void function0() CONSUMES; // expected-warning {{'consumes' attribute only applies to methods}} void function1() TESTS_UNCONSUMED; // expected-warning {{'tests_unconsumed' attribute only applies to methods}} void function2() CALLABLE_WHEN_UNCONSUMED; // expected-warning {{'callable_when_unconsumed' attribute only applies to methods}} -void function3() CONSUMABLE; // expected-warning {{'consumable' attribute only applies to classes}} +void function3() CONSUMABLE(consumed); // expected-warning {{'consumable' attribute only applies to classes}} -class CONSUMABLE AttrTester1 { +class CONSUMABLE(unknown) AttrTester1 { void callableWhenUnconsumed() CALLABLE_WHEN_UNCONSUMED; void consumes() CONSUMES; bool testsUnconsumed() TESTS_UNCONSUMED; @@ -47,3 +47,5 @@ class AttrTester2 { void consumes() CONSUMES; // expected-warning {{consumed analysis attribute is attached to member of class 'AttrTester2' which isn't marked as consumable}} bool testsUnconsumed() TESTS_UNCONSUMED; // expected-warning {{consumed analysis attribute is attached to member of class 'AttrTester2' which isn't marked as consumable}} }; + +class CONSUMABLE(42) AttrTester3; // expected-error {{'consumable' attribute requires an identifier}} |