brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 40b92c4 Raw
38 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3#define PLACE_IN_TCB(NAME) __attribute__((enforce_tcb(NAME)))4#define PLACE_IN_TCB_LEAF(NAME) __attribute__((enforce_tcb_leaf(NAME)))5 6__attribute__((objc_root_class))7@interface AClass8@property(readonly) id propertyNotInAnyTCB;9@end10 11@implementation AClass12- (void)inTCBFoo PLACE_IN_TCB("foo") {13  [self notInAnyTCB]; // expected-warning{{calling 'notInAnyTCB' is a violation of trusted computing base 'foo'}}14}15- (void)inTCBFooAsLeaf PLACE_IN_TCB_LEAF("foo") {16  [self notInAnyTCB]; // no-warning17}18- (void)notInAnyTCB {19}20+ (void)classMethodNotInAnyTCB {21}22+ (void)classMethodInTCBFoo PLACE_IN_TCB("foo") {23  [self inTCBFoo];       // no-warning24  [self inTCBFooAsLeaf]; // no-warning25  [self notInAnyTCB];    // expected-warning{{calling 'notInAnyTCB' is a violation of trusted computing base 'foo'}}26}27@end28 29PLACE_IN_TCB("foo")30void call_objc_method(AClass *object) {31  [object inTCBFoo];                // no-warning32  [object inTCBFooAsLeaf];          // no-warning33  [object notInAnyTCB];             // expected-warning{{calling 'notInAnyTCB' is a violation of trusted computing base 'foo'}}34  [AClass classMethodNotInAnyTCB];  // expected-warning{{calling 'classMethodNotInAnyTCB' is a violation of trusted computing base 'foo'}}35  [AClass classMethodInTCBFoo];     // no-warning36  (void)object.propertyNotInAnyTCB; // expected-warning{{calling 'propertyNotInAnyTCB' is a violation of trusted computing base 'foo'}}37}38