[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Sema / attr-enforce-tcb.cpp
bloba01a1775e94b710436d995bc127a17fe94cb56a5
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 #define PLACE_IN_TCB(NAME) [[clang::enforce_tcb(NAME)]]
4 #define PLACE_IN_TCB_LEAF(NAME) [[clang::enforce_tcb_leaf(NAME)]]
6 PLACE_IN_TCB("foo") void in_tcb_foo();
7 void not_in_tcb();
9 // Test behavior on classes and methods.
10 class C {
11 void bar();
13 PLACE_IN_TCB("foo")
14 void foo() {
15 // TODO: Figure out if we want to support methods at all.
16 // Does it even make sense to isolate individual methods into a TCB?
17 // Maybe a per-class attribute would make more sense?
18 bar(); // expected-warning{{calling 'bar' is a violation of trusted computing base 'foo'}}
22 // Test behavior on templates.
23 template <typename Ty>
24 PLACE_IN_TCB("foo")
25 void foo_never_instantiated() {
26 not_in_tcb(); // expected-warning{{calling 'not_in_tcb' is a violation of trusted computing base 'foo'}}
27 in_tcb_foo(); // no-warning
30 template <typename Ty>
31 PLACE_IN_TCB("foo")
32 void foo_specialized();
34 template<>
35 void foo_specialized<int>() {
36 not_in_tcb(); // expected-warning{{calling 'not_in_tcb' is a violation of trusted computing base 'foo'}}
37 in_tcb_foo(); // no-warning
40 PLACE_IN_TCB("foo")
41 void call_template_good() {
42 foo_specialized<int>(); // no-warning
44 PLACE_IN_TCB("bar")
45 void call_template_bad() {
46 foo_specialized<int>(); // expected-warning{{calling 'foo_specialized<int>' is a violation of trusted computing base 'bar'}}
49 template<typename Ty>
50 void foo_specialization_in_tcb();
52 template<>
53 PLACE_IN_TCB("foo")
54 void foo_specialization_in_tcb<int>() {
55 not_in_tcb(); //expected-warning{{calling 'not_in_tcb' is a violation of trusted computing base 'foo'}}
56 in_tcb_foo(); // no-warning
59 template<>
60 void foo_specialization_in_tcb<double>() {
61 not_in_tcb(); // no-warning
62 in_tcb_foo(); // no-warning
65 PLACE_IN_TCB("foo")
66 void call_specialization_in_tcb() {
67 foo_specialization_in_tcb<int>(); // no-warning
68 foo_specialization_in_tcb<long>(); // expected-warning{{calling 'foo_specialization_in_tcb<long>' is a violation of trusted computing base 'foo'}}
69 foo_specialization_in_tcb<double>(); // expected-warning{{'foo_specialization_in_tcb<double>' is a violation of trusted computing base 'foo'}}