xref: /minix3/external/bsd/llvm/dist/clang/test/FixIt/fixit-cxx11-attributes.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -verify -std=c++11 %s
2*f4a2713aSLionel Sambuc // RUN: cp %s %t
3*f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -x c++ -std=c++11 -fixit %t
4*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -Wall -pedantic -x c++ -std=c++11 %t
5*f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -std=c++11 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc namespace ClassSpecifier {
8*f4a2713aSLionel Sambuc   class [[]] [[]]
9*f4a2713aSLionel Sambuc     attr_after_class_name_decl [[]] [[]]; // expected-error {{an attribute list cannot appear here}}
10*f4a2713aSLionel Sambuc     // CHECK: fix-it:{{.*}}:{9:5-9:5}
11*f4a2713aSLionel Sambuc     // CHECK: fix-it:{{.*}}:{9:32-9:41}
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc   class [[]] [[]]
14*f4a2713aSLionel Sambuc    attr_after_class_name_definition [[]] [[]] [[]]{}; // expected-error {{an attribute list cannot appear here}}
15*f4a2713aSLionel Sambuc    // CHECK: fix-it:{{.*}}:{14:4-14:4}
16*f4a2713aSLionel Sambuc    // CHECK: fix-it:{{.*}}:{14:37-14:51}
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc   class base {};
19*f4a2713aSLionel Sambuc   class [[]] [[]] final_class
20*f4a2713aSLionel Sambuc     alignas(float) [[]] final // expected-error {{an attribute list cannot appear here}}
21*f4a2713aSLionel Sambuc     alignas(float) [[]] [[]] alignas(float): base{}; // expected-error {{an attribute list cannot appear here}}
22*f4a2713aSLionel Sambuc     // CHECK: fix-it:{{.*}}:{19:19-19:19}
23*f4a2713aSLionel Sambuc     // CHECK: fix-it:{{.*}}:{20:5-20:25}
24*f4a2713aSLionel Sambuc     // CHECK: fix-it:{{.*}}:{19:19-19:19}
25*f4a2713aSLionel Sambuc     // CHECK: fix-it:{{.*}}:{21:5-21:44}
26*f4a2713aSLionel Sambuc 
27*f4a2713aSLionel Sambuc   class [[]] [[]] final_class_another
28*f4a2713aSLionel Sambuc     [[]] [[]] alignas(16) final // expected-error {{an attribute list cannot appear here}}
29*f4a2713aSLionel Sambuc     [[]] [[]] alignas(16) [[]]{}; // expected-error {{an attribute list cannot appear here}}
30*f4a2713aSLionel Sambuc     // CHECK: fix-it:{{.*}}:{27:19-27:19}
31*f4a2713aSLionel Sambuc     // CHECK: fix-it:{{.*}}:{28:5-28:27}
32*f4a2713aSLionel Sambuc     // CHECK: fix-it:{{.*}}:{27:19-27:19}
33*f4a2713aSLionel Sambuc     // CHECK: fix-it:{{.*}}:{29:5-29:31}
34*f4a2713aSLionel Sambuc }
35*f4a2713aSLionel Sambuc 
36*f4a2713aSLionel Sambuc namespace BaseSpecifier {
37*f4a2713aSLionel Sambuc   struct base1 {};
38*f4a2713aSLionel Sambuc   struct base2 {};
39*f4a2713aSLionel Sambuc   class with_base_spec : public [[a]] // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}}
40*f4a2713aSLionel Sambuc   // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:26-[[@LINE-1]]:26}:"[{{\[}}a]]"
41*f4a2713aSLionel Sambuc   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:33-[[@LINE-2]]:39}:""
42*f4a2713aSLionel Sambuc                          virtual [[b]] base1, // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}}
43*f4a2713aSLionel Sambuc   // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:26-[[@LINE-4]]:26}:"[{{\[}}b]]"
44*f4a2713aSLionel Sambuc   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:34-[[@LINE-2]]:40}:""
45*f4a2713aSLionel Sambuc                          virtual [[c]] // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}}
46*f4a2713aSLionel Sambuc   // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:26-[[@LINE-1]]:26}:"[{{\[}}c]]"
47*f4a2713aSLionel Sambuc   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:34-[[@LINE-2]]:40}:""
48*f4a2713aSLionel Sambuc                          public [[d]] base2 {}; // expected-error {{an attribute list cannot appear here}} expected-warning {{unknown}}
49*f4a2713aSLionel Sambuc   // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:26-[[@LINE-4]]:26}:"[{{\[}}d]]"
50*f4a2713aSLionel Sambuc   // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:33-[[@LINE-2]]:39}:""
51*f4a2713aSLionel Sambuc }
52