brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.0 KiB · c8d0716 Raw
101 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3int foo();4 5__attribute__((objc_root_class))6@interface AClass7- (void)bothTCBAndTCBLeafOnSeparateRedeclarations __attribute__((enforce_tcb("x"))); // expected-note{{conflicting attribute is here}}8 9- (void)bothTCBAndTCBLeafOnSeparateRedeclarationsOppositeOrder __attribute__((enforce_tcb_leaf("x"))); // expected-note{{conflicting attribute is here}}10 11- (void)bothTCBAndTCBLeafButDifferentIdentifiersOnSeparateRedeclarations __attribute__((enforce_tcb("x")));12 13- (void)bothTCBAndTCBLeafButDifferentIdentifiersOnSeparateRedeclarationsOppositeOrder __attribute__((enforce_tcb_leaf("x")));14 15- (void)onInterfaceOnly __attribute__((enforce_tcb("test")));16@end17 18@interface AClass (NoImplementation)19- (void)noArguments __attribute__((enforce_tcb)); // expected-error{{'enforce_tcb' attribute takes one argument}}20 21- (void)tooManyArguments __attribute__((enforce_tcb("test", 12))); // expected-error{{'enforce_tcb' attribute takes one argument}}22 23- (void)wrongArgumentType __attribute__((enforce_tcb(12))); // expected-error{{expected string literal as argument of 'enforce_tcb' attribute}}24 25- (void)noArgumentsLeaf __attribute__((enforce_tcb_leaf)); // expected-error{{'enforce_tcb_leaf' attribute takes one argument}}26 27- (void)tooManyArgumentsLeaf __attribute__((enforce_tcb_leaf("test", 12))); // expected-error{{'enforce_tcb_leaf' attribute takes one argument}}28 29- (void)wrongArgumentTypeLeaf __attribute__((enforce_tcb_leaf(12))); // expected-error{{expected string literal as argument of 'enforce_tcb_leaf' attribute}}30@end31 32@implementation AClass33- (void)onInterfaceOnly {34  foo(); // expected-warning{{calling 'foo' is a violation of trusted computing base 'test'}}35}36 37- (void)bothTCBAndTCBLeaf38    __attribute__((enforce_tcb("x")))39    __attribute__((enforce_tcb_leaf("x"))) // expected-error{{attributes 'enforce_tcb_leaf("x")' and 'enforce_tcb("x")' are mutually exclusive}}40{41  foo(); // no-warning42}43 44- (void)bothTCBAndTCBLeafOnSeparateRedeclarations45    __attribute__((enforce_tcb_leaf("x"))) // expected-error{{attributes 'enforce_tcb_leaf("x")' and 'enforce_tcb("x")' are mutually exclusive}}46{47  // Error recovery: no need to emit a warning when we didn't48  // figure out our attributes to begin with.49  foo(); // no-warning50}51 52- (void)bothTCBAndTCBLeafOppositeOrder53    __attribute__((enforce_tcb_leaf("x")))54    __attribute__((enforce_tcb("x"))) // expected-error{{attributes 'enforce_tcb("x")' and 'enforce_tcb_leaf("x")' are mutually exclusive}}55{56  foo(); // no-warning57}58 59- (void)bothTCBAndTCBLeafOnSeparateRedeclarationsOppositeOrder60    __attribute__((enforce_tcb("x"))) // expected-error{{attributes 'enforce_tcb("x")' and 'enforce_tcb_leaf("x")' are mutually exclusive}}61{62  foo(); // no-warning63}64 65- (void)bothTCBAndTCBLeafButDifferentIdentifiers66    __attribute__((enforce_tcb("x")))67    __attribute__((enforce_tcb_leaf("y"))) // no-error68{69  foo(); // expected-warning{{calling 'foo' is a violation of trusted computing base 'x'}}70}71 72- (void)bothTCBAndTCBLeafButDifferentIdentifiersOppositeOrder73    __attribute__((enforce_tcb_leaf("x")))74    __attribute__((enforce_tcb("y"))) // no-error75{76  foo(); // expected-warning{{calling 'foo' is a violation of trusted computing base 'y'}}77}78 79- (void)bothTCBAndTCBLeafButDifferentIdentifiersOnSeparateRedeclarations80    __attribute__((enforce_tcb_leaf("y"))) // no-error81{82  foo(); // expected-warning{{calling 'foo' is a violation of trusted computing base 'x'}}83}84 85- (void)bothTCBAndTCBLeafButDifferentIdentifiersOnSeparateRedeclarationsOppositeOrder86    __attribute__((enforce_tcb("y"))) {87  foo(); // expected-warning{{calling 'foo' is a violation of trusted computing base 'y'}}88}89 90- (void)errorRecoveryOverIndividualTCBs91    __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}}94{95  // FIXME: Ideally this should warn. The conflict between attributes96  // for TCB "x" shouldn't affect the warning about TCB "y".97  foo(); // no-warning98}99 100@end101