[X86] Move getGFNICtrlMask before CTLZ/CTTZ lowering. NFC.
[llvm-project.git] / clang / test / SemaCXX / attr-suppress.cpp
blobe8f6d979880916d5183afb5ca32b0258e445eb6a
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only %s -verify
3 [[gsl::suppress("globally")]];
5 namespace N {
6 [[gsl::suppress("in-a-namespace")]];
9 [[gsl::suppress("readability-identifier-naming")]] void f_() {
10 int *p;
11 [[gsl::suppress("type", "bounds")]] {
12 p = reinterpret_cast<int *>(7);
15 [[gsl::suppress]] int x; // expected-error {{'suppress' attribute takes at least 1 argument}}
16 [[gsl::suppress()]] int y; // expected-error {{'suppress' attribute takes at least 1 argument}}
17 int [[gsl::suppress("r")]] z; // expected-error {{'suppress' attribute cannot be applied to types}}
18 [[gsl::suppress(f_)]] float f; // expected-error {{expected string literal as argument of 'suppress' attribute}}
21 union [[gsl::suppress("type.1")]] U {
22 int i;
23 float f;
26 // This doesn't really suppress anything but why not?
27 [[clang::suppress]];
29 namespace N {
30 [[clang::suppress("in-a-namespace")]];
31 } // namespace N
33 [[clang::suppress]] int global = 42;
35 [[clang::suppress]] void foo() {
36 [[clang::suppress]] int *p;
38 [[clang::suppress]] int a = 0; // no-warning
39 [[clang::suppress()]] int b = 1; // no-warning
40 [[clang::suppress("a")]] int c = a + b; // no-warning
41 [[clang::suppress("a", "b")]] b = c - a; // no-warning
43 [[clang::suppress("a", "b")]] if (b == 10) a += 4; // no-warning
44 [[clang::suppress]] while (true) {} // no-warning
45 [[clang::suppress]] switch (a) { // no-warning
46 default:
47 c -= 10;
50 int [[clang::suppress("r")]] z;
51 // expected-error@-1 {{'suppress' attribute cannot be applied to types}}
52 [[clang::suppress(foo)]] float f;
53 // expected-error@-1 {{expected string literal as argument of 'suppress' attribute}}
56 class [[clang::suppress("type.1")]] V {
57 int i;
58 float f;
61 // FIXME: There's no good reason why we shouldn't support this case.
62 // But it doesn't look like clang generally supports such attributes yet.
63 class W : [[clang::suppress]] public V { // expected-error{{'suppress' attribute cannot be applied to a base specifier}}