[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Sema / attr-enforce-tcb.m
blob40b92c4293ec7168791a450c57b31fccab19546e
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 #define PLACE_IN_TCB(NAME) __attribute__((enforce_tcb(NAME)))
4 #define PLACE_IN_TCB_LEAF(NAME) __attribute__((enforce_tcb_leaf(NAME)))
6 __attribute__((objc_root_class))
7 @interface AClass
8 @property(readonly) id propertyNotInAnyTCB;
9 @end
11 @implementation AClass
12 - (void)inTCBFoo PLACE_IN_TCB("foo") {
13   [self notInAnyTCB]; // expected-warning{{calling 'notInAnyTCB' is a violation of trusted computing base 'foo'}}
15 - (void)inTCBFooAsLeaf PLACE_IN_TCB_LEAF("foo") {
16   [self notInAnyTCB]; // no-warning
18 - (void)notInAnyTCB {
20 + (void)classMethodNotInAnyTCB {
22 + (void)classMethodInTCBFoo PLACE_IN_TCB("foo") {
23   [self inTCBFoo];       // no-warning
24   [self inTCBFooAsLeaf]; // no-warning
25   [self notInAnyTCB];    // expected-warning{{calling 'notInAnyTCB' is a violation of trusted computing base 'foo'}}
27 @end
29 PLACE_IN_TCB("foo")
30 void call_objc_method(AClass *object) {
31   [object inTCBFoo];                // no-warning
32   [object inTCBFooAsLeaf];          // no-warning
33   [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-warning
36   (void)object.propertyNotInAnyTCB; // expected-warning{{calling 'propertyNotInAnyTCB' is a violation of trusted computing base 'foo'}}