1 // RUN: %clang_cc1 -fsyntax-only -verify %s
5 __attribute__((objc_root_class))
7 - (void)bothTCBAndTCBLeafOnSeparateRedeclarations __attribute__((enforce_tcb("x"))); // expected-note{{conflicting attribute is here}}
9 - (void)bothTCBAndTCBLeafOnSeparateRedeclarationsOppositeOrder __attribute__((enforce_tcb_leaf("x"))); // expected-note{{conflicting attribute is here}}
11 - (void)bothTCBAndTCBLeafButDifferentIdentifiersOnSeparateRedeclarations __attribute__((enforce_tcb("x")));
13 - (void)bothTCBAndTCBLeafButDifferentIdentifiersOnSeparateRedeclarationsOppositeOrder __attribute__((enforce_tcb_leaf("x")));
15 - (void)onInterfaceOnly __attribute__((enforce_tcb("test")));
18 @interface AClass (NoImplementation)
19 - (void)noArguments __attribute__((enforce_tcb)); // expected-error{{'enforce_tcb' attribute takes one argument}}
21 - (void)tooManyArguments __attribute__((enforce_tcb("test", 12))); // expected-error{{'enforce_tcb' attribute takes one argument}}
23 - (void)wrongArgumentType __attribute__((enforce_tcb(12))); // expected-error{{'enforce_tcb' attribute requires a string}}
25 - (void)noArgumentsLeaf __attribute__((enforce_tcb_leaf)); // expected-error{{'enforce_tcb_leaf' attribute takes one argument}}
27 - (void)tooManyArgumentsLeaf __attribute__((enforce_tcb_leaf("test", 12))); // expected-error{{'enforce_tcb_leaf' attribute takes one argument}}
29 - (void)wrongArgumentTypeLeaf __attribute__((enforce_tcb_leaf(12))); // expected-error{{'enforce_tcb_leaf' attribute requires a string}}
32 @implementation AClass
33 - (void)onInterfaceOnly {
34 foo(); // expected-warning{{calling 'foo' is a violation of trusted computing base 'test'}}
37 - (void)bothTCBAndTCBLeaf
38 __attribute__((enforce_tcb("x")))
39 __attribute__((enforce_tcb_leaf("x"))) // expected-error{{attributes 'enforce_tcb_leaf("x")' and 'enforce_tcb("x")' are mutually exclusive}}
44 - (void)bothTCBAndTCBLeafOnSeparateRedeclarations
45 __attribute__((enforce_tcb_leaf("x"))) // expected-error{{attributes 'enforce_tcb_leaf("x")' and 'enforce_tcb("x")' are mutually exclusive}}
47 // Error recovery: no need to emit a warning when we didn't
48 // figure out our attributes to begin with.
52 - (void)bothTCBAndTCBLeafOppositeOrder
53 __attribute__((enforce_tcb_leaf("x")))
54 __attribute__((enforce_tcb("x"))) // expected-error{{attributes 'enforce_tcb("x")' and 'enforce_tcb_leaf("x")' are mutually exclusive}}
59 - (void)bothTCBAndTCBLeafOnSeparateRedeclarationsOppositeOrder
60 __attribute__((enforce_tcb("x"))) // expected-error{{attributes 'enforce_tcb("x")' and 'enforce_tcb_leaf("x")' are mutually exclusive}}
65 - (void)bothTCBAndTCBLeafButDifferentIdentifiers
66 __attribute__((enforce_tcb("x")))
67 __attribute__((enforce_tcb_leaf("y"))) // no-error
69 foo(); // expected-warning{{calling 'foo' is a violation of trusted computing base 'x'}}
72 - (void)bothTCBAndTCBLeafButDifferentIdentifiersOppositeOrder
73 __attribute__((enforce_tcb_leaf("x")))
74 __attribute__((enforce_tcb("y"))) // no-error
76 foo(); // expected-warning{{calling 'foo' is a violation of trusted computing base 'y'}}
79 - (void)bothTCBAndTCBLeafButDifferentIdentifiersOnSeparateRedeclarations
80 __attribute__((enforce_tcb_leaf("y"))) // no-error
82 foo(); // expected-warning{{calling 'foo' is a violation of trusted computing base 'x'}}
85 - (void)bothTCBAndTCBLeafButDifferentIdentifiersOnSeparateRedeclarationsOppositeOrder
86 __attribute__((enforce_tcb("y"))) {
87 foo(); // expected-warning{{calling 'foo' is a violation of trusted computing base 'y'}}
90 - (void)errorRecoveryOverIndividualTCBs
91 __attribute__((enforce_tcb("y")))
92 __attribute__((enforce_tcb("x")))
93 __attribute__((enforce_tcb_leaf("x"))) // expected-error{{attributes 'enforce_tcb_leaf("x")' and 'enforce_tcb("x")' are mutually exclusive}}
95 // FIXME: Ideally this should warn. The conflict between attributes
96 // for TCB "x" shouldn't affect the warning about TCB "y".