Debian Codegraph @

clang/test/FixIt/fixit-cxx0x-attributes.cpp

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -fno-diagnostics-show-line-numbers %s 2>&1 | FileCheck %s -strict-whitespace
3
4 [[nodiscard]] enum class E1 { };
5 // expected-error@-1 {{misplaced attributes; expected attributes here}}
6 // CHECK: {{^}}{{\[\[}}nodiscard]] enum class E1 { };
7 // CHECK: {{^}}~~~~~~~~~~~~~ ^
8 // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:1-[[@LINE-4]]:15}:""
9 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:25-[[@LINE-5]]:25}:"{{\[\[}}nodiscard]]"
10
11 [[nodiscard]] enum struct E2 { };
12 // expected-error@-1 {{misplaced attributes; expected attributes here}}
13 // CHECK: {{^}}{{\[\[}}nodiscard]] enum struct E2 { };
14 // CHECK: {{^}}~~~~~~~~~~~~~ ^
15 // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:1-[[@LINE-4]]:15}:""
16 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:26-[[@LINE-5]]:26}:"{{\[\[}}nodiscard]]"
17
18 [[nodiscard]] enum class E3 { };
19 // expected-error@-1 {{misplaced attributes; expected attributes here}}
20 // CHECK: {{^}}{{\[\[}}nodiscard]] enum class E3 { };
21 // CHECK: {{^}}~~~~~~~~~~~~~ ^
22 // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:1-[[@LINE-4]]:15}:""
23 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:34-[[@LINE-5]]:34}:"{{\[\[}}nodiscard]]"
24
25 [[nodiscard]] enum /*comment*/ class E4 { };
26 // expected-error@-1 {{misplaced attributes; expected attributes here}}
27 // CHECK: {{^}}{{\[\[}}nodiscard]] enum /*comment*/ class E4 { };
28 // CHECK: {{^}}~~~~~~~~~~~~~ ^
29 // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:1-[[@LINE-4]]:15}:""
30 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:38-[[@LINE-5]]:38}:"{{\[\[}}nodiscard]]"
31
32 [[nodiscard]] enum { A = 0 };
33 // expected-error@-1 {{misplaced attributes; expected attributes here}}
34 // CHECK: {{^}}{{\[\[}}nodiscard]] enum { A = 0 };
35 // CHECK: {{^}}~~~~~~~~~~~~~ ^
36 // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:1-[[@LINE-4]]:15}:""
37 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:19-[[@LINE-5]]:19}:"{{\[\[}}nodiscard]]"
38
39 namespace NS {
40 enum class E5;
41 }
42
43 [[nodiscard]] enum class NS::E5 { };
44 // expected-error@-1 {{misplaced attributes; expected attributes here}}
45 // CHECK: {{^}}{{\[\[}}nodiscard]] enum class NS::E5 { };
46 // CHECK: {{^}}~~~~~~~~~~~~~ ^
47 // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:1-[[@LINE-4]]:15}:""
48 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:25-[[@LINE-5]]:25}:"{{\[\[}}nodiscard]]"