riccibruno updated this revision to Diff 281044.
riccibruno marked 3 inline comments as done.
riccibruno added a comment.
Address Erich's comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84658/new/
https://reviews.llvm.org/D84658
Files:
clang/include/clang/AST/Decl.h
clang/include/clang/AST/PrettyPrinter.h
clang/lib/AST/Decl.cpp
clang/lib/Sema/SemaDecl.cpp
clang/test/AST/ast-dump-APValue-anon-union.cpp
clang/test/AST/ast-dump-record-definition-data-json.cpp
clang/test/Analysis/explain-svals.cpp
clang/test/CXX/special/class.dtor/p5-0x.cpp
clang/test/Index/annotate-comments-typedef.m
clang/test/Index/annotate-tokens.cpp
clang/test/Index/c-index-api-loadTU-test.m
clang/test/Index/c-index-getCursor-test.m
clang/test/Index/linkage.c
clang/test/Index/load-decls.c
clang/test/Index/load-namespaces.cpp
clang/test/Index/preamble.c
clang/test/Index/print-bitwidth.c
clang/test/Index/print-type.c
clang/test/Index/print-type.cpp
clang/test/Index/recursive-cxx-member-calls.cpp
clang/test/Index/targeted-annotation.c
clang/test/Index/targeted-cursor.c
clang/test/Index/usrs.m
clang/test/Modules/module-private.cpp
clang/test/Sema/address-packed.c
clang/test/Sema/attr-flag-enum.c
clang/test/Sema/transparent-union.c
clang/test/SemaCXX/attr-unused.cpp
clang/test/SemaCXX/cxx0x-nontrivial-union.cpp
clang/test/SemaCXX/lambda-expressions.cpp
clang/test/SemaCXX/ms-interface.cpp
clang/test/SemaCXX/warn-large-by-value-copy.cpp
clang/test/SemaObjCXX/arc-0x.mm
clang/test/Tooling/clang-diff-ast.cpp
clang/unittests/AST/ASTTraverserTest.cpp
Index: clang/unittests/AST/ASTTraverserTest.cpp
===================================================================
--- clang/unittests/AST/ASTTraverserTest.cpp
+++ clang/unittests/AST/ASTTraverserTest.cpp
@@ -825,7 +825,7 @@
| |-FieldDecl ''
| |-FieldDecl ''
| |-FieldDecl ''
-| `-CXXDestructorDecl '~'
+| `-CXXDestructorDecl '~(unnamed class at input.cc:9:3)'
|-ImplicitCastExpr
| `-DeclRefExpr 'a'
|-DeclRefExpr 'b'
Index: clang/test/Tooling/clang-diff-ast.cpp
===================================================================
--- clang/test/Tooling/clang-diff-ast.cpp
+++ clang/test/Tooling/clang-diff-ast.cpp
@@ -56,7 +56,7 @@
int not_initialized;
// CHECK: CXXConstructorDecl: :X(void (char, int){{( __attribute__\(\(thiscall\)\))?}})(
// CHECK-NEXT: ParmVarDecl: s(char)
- // CHECK-NEXT: ParmVarDecl: (int)
+ // CHECK-NEXT: ParmVarDecl: (unnamed variable at {{.*}}:64:16 of type int)(int)
// CHECK-NEXT: CXXCtorInitializer: Base
// CHECK-NEXT: CXXConstructExpr
// CHECK-NEXT: CXXCtorInitializer: m
Index: clang/test/SemaObjCXX/arc-0x.mm
===================================================================
--- clang/test/SemaObjCXX/arc-0x.mm
+++ clang/test/SemaObjCXX/arc-0x.mm
@@ -154,15 +154,17 @@
// functions of the containing class.
struct S0 {
union {
- id f0; // expected-note 6 {{'' is implicitly deleted because variant field 'f0' is an ObjC pointer}}
+ id f0; // expected-note-re 6 {{of '(anonymous union at {{.*}}:156:5)' is implicitly deleted because variant field 'f0' is an ObjC pointer}}
char f1;
};
};
struct S1 {
union {
- union { // expected-note {{copy constructor of 'S1' is implicitly deleted because field '' has a deleted copy constructor}} expected-note {{copy assignment operator of 'S1' is implicitly deleted because field '' has a deleted copy assignment operator}} expected-note 4 {{'S1' is implicitly deleted because field '' has a deleted}}
- id f0; // expected-note 2 {{'' is implicitly deleted because variant field 'f0' is an ObjC pointer}}
+ union { // expected-note-re {{copy constructor of 'S1' is implicitly deleted because field '(unnamed field of type test_union::S1::(anonymous union at {{.*}}:164:7))' has a deleted copy constructor}}
+ // expected-note-re@-1 {{copy assignment operator of 'S1' is implicitly deleted because field '(unnamed field of type test_union::S1::(anonymous union at{{.*}}:164:7))' has a deleted copy assignment operator}}
+ // expected-note-re@-2 4{{'S1' is implicitly deleted because field '(unnamed field of type test_union::S1::(anonymous union at {{.*}}:164:7))' has a deleted}}
+ id f0; // expected-note-re 2 {{of '(anonymous union at {{.*}}:164:7)' is implicitly deleted because variant field 'f0' is an ObjC pointer}}
char f1;
};
int f2;
@@ -172,7 +174,7 @@
struct S2 {
union {
// FIXME: the note should say 'f0' is causing the special functions to be deleted.
- struct { // expected-note 6 {{'S2' is implicitly deleted because variant field '' has a non-trivial}}
+ struct { // expected-note-re 6 {{of 'S2' is implicitly deleted because variant field '(unnamed field of type test_union::S2::(anonymous struct at {{.*}}:177:7))' has a non-trivial}}
id f0;
int f1;
};
@@ -190,13 +192,13 @@
S2 *x6;
static union { // expected-error {{call to implicitly-deleted default constructor of}}
- id g0; // expected-note {{default constructor of '' is implicitly deleted because variant field 'g0' is an ObjC pointer}}
+ id g0; // expected-note-re {{default constructor of '(anonymous union at {{.*}}:194:10)' is implicitly deleted because variant field 'g0' is an ObjC pointer}}
};
static union { // expected-error {{call to implicitly-deleted default constructor of}}
- union { // expected-note {{default constructor of '' is implicitly deleted because field '' has a deleted default constructor}}
- union { // expected-note {{default constructor of '' is implicitly deleted because field '' has a deleted default constructor}}
- __weak id g1; // expected-note {{default constructor of '' is implicitly deleted because variant field 'g1' is an ObjC pointer}}
+ union { // expected-note-re {{default constructor of '(anonymous union at {{.*}}:198:10)' is implicitly deleted because field '(unnamed field of type test_union::(anonymous union at {{.*}}:199:5))' has a deleted default constructor}}
+ union { // expected-note-re {{default constructor of '(anonymous union at {{.*}}:199:5)' is implicitly deleted because field '(unnamed field of type test_union::(anonymous union at {{.*}}:200:7))' has a deleted default constructor}}
+ __weak id g1; // expected-note-re {{default constructor of '(anonymous union at {{.*}}:200:7)' is implicitly deleted because variant field 'g1' is an ObjC pointer}}
int g2;
};
int g3;
Index: clang/test/SemaCXX/warn-large-by-value-copy.cpp
===================================================================
--- clang/test/SemaCXX/warn-large-by-value-copy.cpp
+++ clang/test/SemaCXX/warn-large-by-value-copy.cpp
@@ -16,13 +16,13 @@
S101 f101(S101 s) { return s; } // expected-warning {{return value of 'f101' is a large (101 bytes) pass-by-value object}} \
// expected-warning {{'s' is a large (101 bytes) pass-by-value argument}}
-void f101_no_param_name(S101) {} // expected-warning {{'' is a large (101 bytes) pass-by-value argument}}
+void f101_no_param_name(S101) {} // expected-warning-re {{'(unnamed variable at {{.*}}:19:29 of type rdar8548050::S101)' is a large (101 bytes) pass-by-value argument}}
// FIXME: Don't warn when when the return value is subject to (N)RVO.
template <typename T> T foo_template(T);
template <> S101 foo_template(S101) { return S101(); } // expected-warning {{return value of 'foo_template<rdar8548050::S101>' is a large}}
- // expected-warning@-1 {{'' is a large (101 bytes) pass-by-value argument}}
+ // expected-warning-re@-1 {{'(unnamed variable at {{.*}}:24:35 of type rdar8548050::S101)' is a large (101 bytes) pass-by-value argument}}
typedef int Arr[200];
void farr(Arr a) { }
Index: clang/test/SemaCXX/ms-interface.cpp
===================================================================
--- clang/test/SemaCXX/ms-interface.cpp
+++ clang/test/SemaCXX/ms-interface.cpp
@@ -10,7 +10,7 @@
bool operator!();
// expected-error@+1 {{operator 'operator int' is not permitted within an interface type}}
operator int();
- // expected-error@+1 {{nested class I1::(anonymous) is not permitted within an interface type}}
+ // expected-error-re@+1 {{nested class I1::(unnamed struct at {{.*}}:14:3) is not permitted within an interface type}}
struct { int a; };
void fn2() {
struct A { }; // should be ignored: not a nested class
Index: clang/test/SemaCXX/lambda-expressions.cpp
===================================================================
--- clang/test/SemaCXX/lambda-expressions.cpp
+++ clang/test/SemaCXX/lambda-expressions.cpp
@@ -120,15 +120,18 @@
};
void g(P &p, Q &q, R &r) {
// FIXME: The note attached to the second error here is just amazingly bad.
- auto pp = [p]{}; // expected-error {{deleted constructor}} expected-cxx14-error {{deleted copy constructor of '(lambda}}
- // expected-cxx14-note@-1 {{copy constructor of '' is implicitly deleted because field '' has a deleted copy constructor}}
- auto qq = [q]{}; // expected-error {{deleted function}} expected-note {{because}}
+ auto pp = [p] {}; // expected-error {{call to deleted constructor of 'SpecialMembers::P'}}
+ // expected-cxx14-error-re@-1 {{call to implicitly-deleted copy constructor of '(lambda at {{.*}}:123:15)'}}
+ // expected-cxx14-note-re@-2 {{copy constructor of '(unnamed class at {{.*}}:123:15)' is implicitly deleted because field '(unnamed field at {{.*}}:123:16 of type SpecialMembers::P)' has a deleted copy constructor}}
- auto a = [r]{}; // expected-note 2{{here}}
+ auto qq = [q] {}; // expected-error {{attempt to use a deleted function}}
+ // expected-note-re@-1 {{destructor of '(unnamed class at {{.*}}:127:15)' is implicitly deleted because field '(unnamed field at {{.*}}:127:16 of type SpecialMembers::Q)' has a deleted destructor}}
+
+ auto a = [r] {}; // expected-note 2{{lambda expression begins here}}
decltype(a) b = a;
decltype(a) c = static_cast<decltype(a)&&>(a); // ok, copies R
- a = a; // expected-error {{copy assignment operator is implicitly deleted}}
- a = static_cast<decltype(a)&&>(a); // expected-error {{copy assignment operator is implicitly deleted}}
+ a = a; // expected-error-re {{object of type '(lambda at {{.*}}:130:14)' cannot be assigned because its copy assignment operator is implicitly deleted}}
+ a = static_cast<decltype(a) &&>(a); // expected-error-re {{object of type '(lambda at {{.*}}:130:14)' cannot be assigned because its copy assignment operator is implicitly deleted}}
}
}
@@ -652,11 +655,10 @@
namespace captured_name {
void Test() {
- union { // expected-note {{'' declared here}}
+ union { // expected-note-re {{'(unnamed variable of type (anonymous union at {{.*}}:658:3))' declared here}}
int i;
};
- [] { return i; }; // expected-error {{variable '' cannot be implicitly captured in a lambda with no capture-default specified}}
+ [] { return i; }; // expected-error-re {{variable '(unnamed variable of type (anonymous union at {{.*}}:658:3))' cannot be implicitly captured in a lambda with no capture-default specified}}
// expected-note@-1 {{lambda expression begins here}}
-
}
};
Index: clang/test/SemaCXX/cxx0x-nontrivial-union.cpp
===================================================================
--- clang/test/SemaCXX/cxx0x-nontrivial-union.cpp
+++ clang/test/SemaCXX/cxx0x-nontrivial-union.cpp
@@ -136,7 +136,7 @@
template<typename T> struct Test2 {
union {
- struct { // expected-note {{default constructor of 'Test2<pr16061::X>' is implicitly deleted because variant field '' has a non-trivial default constructor}}
+ struct { // expected-note-re {{default constructor of 'Test2<pr16061::X>' is implicitly deleted because variant field '(unnamed field of type struct (anonymous struct at {{.*}}:139:7))' has a non-trivial default constructor}}
T x;
};
};
Index: clang/test/SemaCXX/attr-unused.cpp
===================================================================
--- clang/test/SemaCXX/attr-unused.cpp
+++ clang/test/SemaCXX/attr-unused.cpp
@@ -10,7 +10,8 @@
ns_not_unused::Int_not_unused i1; // expected-warning {{unused variable}}
ns_unused::Int_unused i0; // expected-warning {{'Int_unused' was marked unused but was used}}
- union __attribute__((unused)) { // expected-warning {{'' was marked unused but was used}}
+ union __attribute__((unused)) {
+ // expected-warning-re@-1 {{'(anonymous union at {{.*}}:13:3)' was marked unused but was used}}
int i;
};
(void) i;
Index: clang/test/Sema/transparent-union.c
===================================================================
--- clang/test/Sema/transparent-union.c
+++ clang/test/Sema/transparent-union.c
@@ -124,7 +124,7 @@
unsigned int u1;
unsigned int u2;
};
- struct { // expected-warning {{alignment of field '' (64 bits) does not match the alignment of the first field in transparent union; transparent_union attribute ignored}}
+ struct { // expected-warning-re {{alignment of field '(unnamed field of type struct pr15134v2::(anonymous at {{.*}}:127:3))' (64 bits) does not match the alignment of the first field in transparent union; transparent_union attribute ignored}}
unsigned int u3;
} __attribute__((aligned(8)));
} __attribute__((transparent_union));
Index: clang/test/Sema/attr-flag-enum.c
===================================================================
--- clang/test/Sema/attr-flag-enum.c
+++ clang/test/Sema/attr-flag-enum.c
@@ -7,7 +7,7 @@
};
enum __attribute__((flag_enum)) {
- g = 0x7, // expected-warning {{enumeration value 'g' is out of range of flags in enumeration type ''}}
+ g = 0x7, // expected-warning-re {{enumeration value 'g' is out of range of flags in enumeration type '(unnamed enum at {{.*}}:9:1)'}}
};
enum __attribute__((flag_enum)) flag2 {
Index: clang/test/Sema/address-packed.c
===================================================================
--- clang/test/Sema/address-packed.c
+++ clang/test/Sema/address-packed.c
@@ -136,7 +136,8 @@
};
int *g4(struct S4 *s4) {
- return &s4->inner.i; // expected-warning {{packed member 'i' of class or structure 'S4::(anonymous)'}}
+ return &s4->inner.i;
+ // expected-warning-re@-1 {{packed member 'i' of class or structure 'S4::(unnamed struct at {{.*}}:133:3)'}}
}
struct S5 {
@@ -148,7 +149,8 @@
};
int *g5(struct S5 *s5) {
- return &s5->inner.i; // expected-warning {{packed member 'i' of class or structure 'S5::(anonymous)'}}
+ return &s5->inner.i;
+ // expected-warning-re@-1 {{packed member 'i' of class or structure 'S5::(unnamed struct at {{.*}}:145:3)'}}
}
struct __attribute__((packed, aligned(2))) AlignedTo2 {
@@ -200,7 +202,8 @@
};
int *anonymousInnerUnion(struct S6 *s) {
- return &s->x; // expected-warning {{packed member 'x' of class or structure 'S6::(anonymous)'}}
+ return &s->x;
+ // expected-warning-re@-1 {{packed member 'x' of class or structure 'S6::(anonymous union at {{.*}}:198:3)'}}
}
struct S6a {
Index: clang/test/Modules/module-private.cpp
===================================================================
--- clang/test/Modules/module-private.cpp
+++ clang/test/Modules/module-private.cpp
@@ -86,7 +86,7 @@
typedef __module_private__ int local_typedef; // expected-error{{typedef 'local_typedef' cannot be declared __module_private__}}
}
-void param_private(__module_private__ int) {} // expected-error {{parameter '' cannot be declared __module_private}}
+void param_private(__module_private__ int) {} // expected-error-re {{parameter '(unnamed variable at {{.*}}:89:42 of type int)' cannot be declared __module_private__}}
// Check struct size
struct LikeVisibleStruct {
Index: clang/test/Index/usrs.m
===================================================================
--- clang/test/Index/usrs.m
+++ clang/test/Index/usrs.m
@@ -185,14 +185,14 @@
// CHECK-source: usrs.m:3:52: BinaryOperator= Extent=[3:52 - 3:57]
// CHECK-source: usrs.m:3:52: DeclRefExpr=x:3:33 Extent=[3:52 - 3:53]
// CHECK-source: usrs.m:3:56: DeclRefExpr=y:3:40 Extent=[3:56 - 3:57]
-// CHECK-source: usrs.m:5:1: EnumDecl=:5:1 (Definition) Extent=[5:1 - 8:2]
+// CHECK-source: usrs.m:5:1: EnumDecl=(unnamed enum at {{.*}}:5:1):5:1 (Definition) Extent=[5:1 - 8:2]
// CHECK-source: usrs.m:6:3: EnumConstantDecl=ABA:6:3 (Definition) Extent=[6:3 - 6:6]
// CHECK-source: usrs.m:7:3: EnumConstantDecl=CADABA:7:3 (Definition) Extent=[7:3 - 7:9]
-// CHECK-source: usrs.m:10:1: EnumDecl=:10:1 (Definition) Extent=[10:1 - 13:2]
+// CHECK-source: usrs.m:10:1: EnumDecl=(unnamed enum at {{.*}}:10:1):10:1 (Definition) Extent=[10:1 - 13:2]
// CHECK-source: usrs.m:11:3: EnumConstantDecl=FOO:11:3 (Definition) Extent=[11:3 - 11:6]
// CHECK-source: usrs.m:12:3: EnumConstantDecl=BAR:12:3 (Definition) Extent=[12:3 - 12:6]
// CHECK-source: usrs.m:18:3: TypedefDecl=MyStruct:18:3 (Definition) Extent=[15:1 - 18:11]
-// CHECK-source: usrs.m:15:9: StructDecl=:15:9 (Definition) Extent=[15:9 - 18:2]
+// CHECK-source: usrs.m:15:9: StructDecl=(unnamed struct at {{.*}}:15:9):15:9 (Definition) Extent=[15:9 - 18:2]
// CHECK-source: usrs.m:16:7: FieldDecl=wa:16:7 (Definition) Extent=[16:3 - 16:9]
// CHECK-source: usrs.m:17:7: FieldDecl=moo:17:7 (Definition) Extent=[17:3 - 17:10]
// CHECK-source: usrs.m:20:6: EnumDecl=Pizza:20:6 (Definition) Extent=[20:1 - 23:2]
@@ -281,9 +281,9 @@
// CHECK-source: usrs.m:69:23: UnexposedExpr= Extent=[69:23 - 69:24]
// CHECK-source: usrs.m:69:23: IntegerLiteral= Extent=[69:23 - 69:24]
// CHECK-source: usrs.m:72:6: FunctionDecl=aux_1:72:6 Extent=[72:1 - 72:26]
-// CHECK-source: usrs.m:72:15: ParmDecl=:72:15 (Definition) Extent=[72:12 - 72:15]
-// CHECK-source: usrs.m:72:20: ParmDecl=:72:20 (Definition) Extent=[72:17 - 72:20]
-// CHECK-source: usrs.m:72:25: ParmDecl=:72:25 (Definition) Extent=[72:22 - 72:25]
+// CHECK-source: usrs.m:72:15: ParmDecl=(unnamed variable at {{.*}}:72:15 of type int):72:15 (Definition) Extent=[72:12 - 72:15]
+// CHECK-source: usrs.m:72:20: ParmDecl=(unnamed variable at {{.*}}:72:20 of type int):72:20 (Definition) Extent=[72:17 - 72:20]
+// CHECK-source: usrs.m:72:25: ParmDecl=(unnamed variable at {{.*}}:72:25 of type int):72:25 (Definition) Extent=[72:22 - 72:25]
// CHECK-source: usrs.m:73:5: FunctionDecl=test_multi_declaration:73:5 (Definition) Extent=[73:1 - 77:2]
// CHECK-source: usrs.m:73:34: CompoundStmt= Extent=[73:34 - 77:2]
// CHECK-source: usrs.m:74:3: DeclStmt= Extent=[74:3 - 74:33]
Index: clang/test/Index/targeted-cursor.c
===================================================================
--- clang/test/Index/targeted-cursor.c
+++ clang/test/Index/targeted-cursor.c
@@ -62,4 +62,4 @@
// PREAMBLE-CURSOR1: VarDecl=PreambleVar:2:12
// FIELD-CURSOR1: FieldDecl=z:2:7 (Definition)
-// FIELD-CURSOR2: StructDecl=:13:9 (Definition)
+// FIELD-CURSOR2: StructDecl=(unnamed struct at {{.*}}targeted-top.h:13:9):13:9 (Definition)
Index: clang/test/Index/targeted-annotation.c
===================================================================
--- clang/test/Index/targeted-annotation.c
+++ clang/test/Index/targeted-annotation.c
@@ -45,10 +45,10 @@
// FIELD: Keyword: "int" [2:3 - 2:6] FieldDecl=z:2:7 (Definition)
// FIELD: Identifier: "z" [2:7 - 2:8] FieldDecl=z:2:7 (Definition)
-// FIELD: Punctuation: ";" [2:8 - 2:9] StructDecl=:13:9 (Definition)
+// FIELD: Punctuation: ";" [2:8 - 2:9] StructDecl=(unnamed struct at {{.*}}targeted-top.h:13:9):13:9 (Definition)
// FIELD: Keyword: "int" [3:3 - 3:6] FieldDecl=w:3:7 (Definition)
// FIELD: Identifier: "w" [3:7 - 3:8] FieldDecl=w:3:7 (Definition)
-// FIELD: Punctuation: ";" [3:8 - 3:9] StructDecl=:13:9 (Definition)
+// FIELD: Punctuation: ";" [3:8 - 3:9] StructDecl=(unnamed struct at {{.*}}targeted-top.h:13:9):13:9 (Definition)
// RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -test-annotate-tokens=%S/targeted-nested1.h:1:1:3:1 %s -include %t.h \
// RUN: -Xclang -error-on-deserialized-decl=TopVar \
@@ -86,12 +86,12 @@
// TOP: Punctuation: "#" [5:1 - 5:2] inclusion directive=targeted-nested1.h
// TOP: Identifier: "include" [5:2 - 5:9] inclusion directive=targeted-nested1.h
// TOP: Literal: ""targeted-nested1.h"" [5:10 - 5:30] inclusion directive=targeted-nested1.h
-// TOP: Keyword: "enum" [7:1 - 7:5] EnumDecl=:7:1 (Definition)
-// TOP: Punctuation: "{" [7:6 - 7:7] EnumDecl=:7:1 (Definition)
+// TOP: Keyword: "enum" [7:1 - 7:5] EnumDecl=(unnamed enum at {{.*}}targeted-top.h:7:1):7:1 (Definition)
+// TOP: Punctuation: "{" [7:6 - 7:7] EnumDecl=(unnamed enum at {{.*}}targeted-top.h:7:1):7:1 (Definition)
// TOP: Identifier: "VALUE" [8:3 - 8:8] EnumConstantDecl=VALUE:8:3 (Definition)
// TOP: Punctuation: "=" [8:9 - 8:10] EnumConstantDecl=VALUE:8:3 (Definition)
// TOP: Literal: "3" [8:11 - 8:12] IntegerLiteral=
-// TOP: Punctuation: "}" [9:1 - 9:2] EnumDecl=:7:1 (Definition)
+// TOP: Punctuation: "}" [9:1 - 9:2] EnumDecl=(unnamed enum at {{.*}}targeted-top.h:7:1):7:1 (Definition)
// TOP: Punctuation: ";" [9:2 - 9:3]
// TOP: Keyword: "extern" [11:1 - 11:7]
// TOP: Keyword: "int" [11:8 - 11:11] VarDecl=TopVar:11:12
Index: clang/test/Index/recursive-cxx-member-calls.cpp
===================================================================
--- clang/test/Index/recursive-cxx-member-calls.cpp
+++ clang/test/Index/recursive-cxx-member-calls.cpp
@@ -222,13 +222,13 @@
// CHECK-tokens: Keyword: "int" [7:3 - 7:6] FunctionDecl=memcmp:7:7
// CHECK-tokens: Identifier: "memcmp" [7:7 - 7:13] FunctionDecl=memcmp:7:7
// CHECK-tokens: Punctuation: "(" [7:13 - 7:14] FunctionDecl=memcmp:7:7
-// CHECK-tokens: Keyword: "const" [7:14 - 7:19] ParmDecl=:7:26 (Definition)
-// CHECK-tokens: Keyword: "void" [7:20 - 7:24] ParmDecl=:7:26 (Definition)
-// CHECK-tokens: Punctuation: "*" [7:25 - 7:26] ParmDecl=:7:26 (Definition)
+// CHECK-tokens: Keyword: "const" [7:14 - 7:19] ParmDecl=(unnamed variable at {{.*}}:7:26 of type const void *):7:26 (Definition)
+// CHECK-tokens: Keyword: "void" [7:20 - 7:24] ParmDecl=(unnamed variable at {{.*}}:7:26 of type const void *):7:26 (Definition)
+// CHECK-tokens: Punctuation: "*" [7:25 - 7:26] ParmDecl=(unnamed variable at {{.*}}:7:26 of type const void *):7:26 (Definition)
// CHECK-tokens: Punctuation: "," [7:26 - 7:27] FunctionDecl=memcmp:7:7
-// CHECK-tokens: Keyword: "const" [7:28 - 7:33] ParmDecl=:7:40 (Definition)
-// CHECK-tokens: Keyword: "void" [7:34 - 7:38] ParmDecl=:7:40 (Definition)
-// CHECK-tokens: Punctuation: "*" [7:39 - 7:40] ParmDecl=:7:40 (Definition)
+// CHECK-tokens: Keyword: "const" [7:28 - 7:33] ParmDecl=(unnamed variable at {{.*}}:7:40 of type const void *):7:40 (Definition)
+// CHECK-tokens: Keyword: "void" [7:34 - 7:38] ParmDecl=(unnamed variable at {{.*}}:7:40 of type const void *):7:40 (Definition)
+// CHECK-tokens: Punctuation: "*" [7:39 - 7:40] ParmDecl=(unnamed variable at {{.*}}:7:40 of type const void *):7:40 (Definition)
// CHECK-tokens: Punctuation: "," [7:40 - 7:41] FunctionDecl=memcmp:7:7
// CHECK-tokens: Identifier: "size_t" [7:42 - 7:48] TypeRef=size_t:2:25
// CHECK-tokens: Punctuation: ")" [7:48 - 7:49] FunctionDecl=memcmp:7:7
@@ -236,9 +236,9 @@
// CHECK-tokens: Identifier: "size_t" [8:3 - 8:9] TypeRef=size_t:2:25
// CHECK-tokens: Identifier: "strlen" [8:10 - 8:16] FunctionDecl=strlen:8:10
// CHECK-tokens: Punctuation: "(" [8:16 - 8:17] FunctionDecl=strlen:8:10
-// CHECK-tokens: Keyword: "const" [8:17 - 8:22] ParmDecl=:8:29 (Definition)
-// CHECK-tokens: Keyword: "char" [8:23 - 8:27] ParmDecl=:8:29 (Definition)
-// CHECK-tokens: Punctuation: "*" [8:28 - 8:29] ParmDecl=:8:29 (Definition)
+// CHECK-tokens: Keyword: "const" [8:17 - 8:22] ParmDecl=(unnamed variable at {{.*}}:8:29 of type const char *):8:29 (Definition)
+// CHECK-tokens: Keyword: "char" [8:23 - 8:27] ParmDecl=(unnamed variable at {{.*}}:8:29 of type const char *):8:29 (Definition)
+// CHECK-tokens: Punctuation: "*" [8:28 - 8:29] ParmDecl=(unnamed variable at {{.*}}:8:29 of type const char *):8:29 (Definition)
// CHECK-tokens: Punctuation: ")" [8:29 - 8:30] FunctionDecl=strlen:8:10
// CHECK-tokens: Punctuation: ";" [8:30 - 8:31]
// CHECK-tokens: Punctuation: "}" [9:1 - 9:2]
@@ -1534,13 +1534,13 @@
// CHECK: 4:55: FieldDecl=second:4:55 (Definition) Extent=[4:51 - 4:61]
// CHECK: 6:8: UnexposedDecl=:6:8 (Definition) Extent=[6:1 - 9:2]
// CHECK: 7:7: FunctionDecl=memcmp:7:7 Extent=[7:3 - 7:49]
-// CHECK: 7:26: ParmDecl=:7:26 (Definition) Extent=[7:14 - 7:26]
-// CHECK: 7:40: ParmDecl=:7:40 (Definition) Extent=[7:28 - 7:40]
-// CHECK: 7:48: ParmDecl=:7:48 (Definition) Extent=[7:42 - 7:48]
+// CHECK: 7:26: ParmDecl=(unnamed variable at {{.*}}:7:26 of type const void *):7:26 (Definition) Extent=[7:14 - 7:26]
+// CHECK: 7:40: ParmDecl=(unnamed variable at {{.*}}:7:40 of type const void *):7:40 (Definition) Extent=[7:28 - 7:40]
+// CHECK: 7:48: ParmDecl=(unnamed variable at {{.*}}:7:48 of type size_t):7:48 (Definition) Extent=[7:42 - 7:48]
// CHECK: 7:42: TypeRef=size_t:2:25 Extent=[7:42 - 7:48]
// CHECK: 8:10: FunctionDecl=strlen:8:10 Extent=[8:3 - 8:30]
// CHECK: 8:3: TypeRef=size_t:2:25 Extent=[8:3 - 8:9]
-// CHECK: 8:29: ParmDecl=:8:29 (Definition) Extent=[8:17 - 8:29]
+// CHECK: 8:29: ParmDecl=(unnamed variable at {{.*}}:8:29 of type const char *):8:29 (Definition) Extent=[8:17 - 8:29]
// CHECK: 10:17: Namespace=clang:10:17 (Definition) Extent=[10:1 - 35:2]
// CHECK: 11:9: ClassDecl=IdentifierInfo:11:9 Extent=[11:3 - 11:23]
// CHECK: 12:9: ClassDecl=AttributeList:12:9 (Definition) Extent=[12:3 - 34:4]
Index: clang/test/Index/print-type.cpp
===================================================================
--- clang/test/Index/print-type.cpp
+++ clang/test/Index/print-type.cpp
@@ -142,17 +142,17 @@
// CHECK: FunctionTemplate=tbar:36:3 [type=T (int)] [typekind=FunctionProto] [canonicaltype=type-parameter-0-0 (int)] [canonicaltypekind=FunctionProto] [resulttype=T] [resulttypekind=Unexposed] [isPOD=0]
// CHECK: TemplateTypeParameter=T:35:20 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0]
// CHECK: TypeRef=T:35:20 [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0]
-// CHECK: ParmDecl=:36:11 (Definition) [type=int] [typekind=Int] [isPOD=1]
+// CHECK: ParmDecl=(unnamed variable at {{.*}}:36:11 of type int):36:11 (Definition) [type=int] [typekind=Int] [isPOD=1]
// CHECK: FunctionTemplate=tbar:39:3 [type=T (int *)] [typekind=FunctionProto] [canonicaltype=type-parameter-0-0 (int *)] [canonicaltypekind=FunctionProto] [resulttype=T] [resulttypekind=Unexposed] [isPOD=0]
// CHECK: TemplateTypeParameter=T:38:20 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0]
// CHECK: TypeRef=T:38:20 [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0]
-// CHECK: ParmDecl=:39:11 (Definition) [type=int [5]] [typekind=ConstantArray] [isPOD=1]
+// CHECK: ParmDecl=(unnamed variable at {{.*}}:39:11 of type int *):39:11 (Definition) [type=int [5]] [typekind=ConstantArray] [isPOD=1]
// CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1]
// CHECK: FunctionTemplate=tbar:42:3 [type=T (int *)] [typekind=FunctionProto] [canonicaltype=type-parameter-0-0 (int *)] [canonicaltypekind=FunctionProto] [resulttype=T] [resulttypekind=Unexposed] [isPOD=0]
// CHECK: TemplateTypeParameter=T:41:20 (Definition) [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0]
// CHECK: NonTypeTemplateParameter=size:41:27 (Definition) [type=int] [typekind=Int] [isPOD=1]
// CHECK: TypeRef=T:41:20 [type=T] [typekind=Unexposed] [canonicaltype=type-parameter-0-0] [canonicaltypekind=Unexposed] [isPOD=0]
-// CHECK: ParmDecl=:42:11 (Definition) [type=int [size]] [typekind=DependentSizedArray] [isPOD=0]
+// CHECK: ParmDecl=(unnamed variable at {{.*}}:42:11 of type int *):42:11 (Definition) [type=int [size]] [typekind=DependentSizedArray] [isPOD=0]
// CHECK: DeclRefExpr=size:41:27 [type=int] [typekind=Int] [isPOD=1]
// CHECK: FunctionDecl=foo:44:6 (Definition) [type=void (int, int *)] [typekind=FunctionProto] [canonicaltype=void (int, int *)] [canonicaltypekind=FunctionProto] [resulttype=void] [resulttypekind=Void] [args= [int] [Int] [int []] [IncompleteArray]] [isPOD=0]
// CHECK: ParmDecl=i:44:14 (Definition) [type=int] [typekind=Int] [isPOD=1]
@@ -201,9 +201,9 @@
// CHECK: TypeAliasDecl=baz:76:7 (Definition) [type=baz] [typekind=Typedef] [templateargs/1= [type=A<void>] [typekind=Unexposed]] [canonicaltype=A<void>] [canonicaltypekind=Record] [canonicaltemplateargs/1= [type=void] [typekind=Void]] [isPOD=0]
// CHECK: VarDecl=autoTemplPointer:78:6 (Definition) [type=Specialization<Specialization<bool> &> *] [typekind=Auto] [canonicaltype=Specialization<Specialization<bool> &> *] [canonicaltypekind=Pointer] [isPOD=1] [pointeetype=Specialization<Specialization<bool> &>] [pointeekind=Record]
// CHECK: CallExpr=Bar:17:3 [type=outer::inner::Bar] [typekind=Elaborated] [canonicaltype=outer::inner::Bar] [canonicaltypekind=Record] [args= [outer::Foo<bool> *] [Pointer]] [isPOD=0] [nbFields=3]
-// CHECK: StructDecl=:84:3 (Definition) [type=X::(anonymous struct at {{.*}}print-type.cpp:84:3)] [typekind=Record] [isPOD=1] [nbFields=1] [isAnon=1]
-// CHECK: ClassDecl=:85:3 (Definition) [type=X::(anonymous class at {{.*}}print-type.cpp:85:3)] [typekind=Record] [isPOD=1] [nbFields=1] [isAnon=1]
-// CHECK: UnionDecl=:86:3 (Definition) [type=X::(anonymous union at {{.*}}print-type.cpp:86:3)] [typekind=Record] [isPOD=1] [nbFields=2] [isAnon=1]
-// CHECK: EnumDecl=:87:3 (Definition) [type=X::(anonymous enum at {{.*}}print-type.cpp:87:3)] [typekind=Enum] [isPOD=1] [isAnon=1]
+// CHECK: StructDecl=(anonymous struct at {{.*}}:84:3):84:3 (Definition) [type=X::(anonymous struct at {{.*}}print-type.cpp:84:3)] [typekind=Record] [isPOD=1] [nbFields=1] [isAnon=1]
+// CHECK: ClassDecl=(anonymous class at {{.*}}:85:3):85:3 (Definition) [type=X::(anonymous class at {{.*}}print-type.cpp:85:3)] [typekind=Record] [isPOD=1] [nbFields=1] [isAnon=1]
+// CHECK: UnionDecl=(anonymous union at {{.*}}:86:3):86:3 (Definition) [type=X::(anonymous union at {{.*}}print-type.cpp:86:3)] [typekind=Record] [isPOD=1] [nbFields=2] [isAnon=1]
+// CHECK: EnumDecl=(unnamed enum at {{.*}}:87:3):87:3 (Definition) [type=X::(anonymous enum at {{.*}}print-type.cpp:87:3)] [typekind=Enum] [isPOD=1] [isAnon=1]
// CHECK: Namespace=:90:11 (Definition) [type=] [typekind=Invalid] [isPOD=0] [isAnon=1]
// CHECK: Namespace=InlineNS:94:18 (Definition) [type=] [typekind=Invalid] [isPOD=0] [isAnonRecDecl=0] [isInlineNamespace=1]
Index: clang/test/Index/print-type.c
===================================================================
--- clang/test/Index/print-type.c
+++ clang/test/Index/print-type.c
@@ -40,7 +40,7 @@
// CHECK: ParmDecl=arr:3:40 (Definition) [type=int [5]] [typekind=ConstantArray] [isPOD=1]
// CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1]
// CHECK: ParmDecl=fn:3:55 (Definition) [type=void (*)(int)] [typekind=Pointer] [canonicaltype=void (*)(int)] [canonicaltypekind=Pointer] [isPOD=1] [pointeetype=void (int)] [pointeekind=FunctionProto]
-// CHECK: ParmDecl=:3:62 (Definition) [type=int] [typekind=Int] [isPOD=1]
+// CHECK: ParmDecl=(unnamed variable at {{.*}}:3:62 of type int):3:62 (Definition) [type=int] [typekind=Int] [isPOD=1]
// CHECK: CompoundStmt= [type=] [typekind=Invalid] [isPOD=0]
// CHECK: CallExpr=fn:3:55 [type=void] [typekind=Void] [args= [int] [Int]] [isPOD=0]
// CHECK: DeclRefExpr=fn:3:55 [type=void (*)(int)] [typekind=Pointer] [canonicaltype=void (*)(int)] [canonicaltypekind=Pointer] [isPOD=1] [pointeetype=void (int)] [pointeekind=FunctionProto]
@@ -69,10 +69,10 @@
// CHECK: StructDecl=Struct:16:8 (Definition) [type=struct Struct] [typekind=Record] [isPOD=1]
// CHECK: FunctionDecl=elaboratedStructType:16:32 [type=struct Struct ()] [typekind=FunctionNoProto] [canonicaltype=struct Struct ()] [canonicaltypekind=FunctionNoProto] [resulttype=struct Struct] [resulttypekind=Elaborated] [isPOD=0]
// CHECK: TypeRef=struct Struct:16:8 [type=struct Struct] [typekind=Record] [isPOD=1]
-// CHECK: StructDecl=:18:1 (Definition) [type=struct (anonymous at {{.*}}print-type.c:18:1)] [typekind=Record] [isPOD=1] [nbFields=2] [isAnon=1] [isAnonRecDecl=0]
-// CHECK: StructDecl=:23:1 (Definition) [type=struct (anonymous at {{.*}}print-type.c:23:1)] [typekind=Record] [isPOD=1] [nbFields=1] [isAnon=1] [isAnonRecDecl=0]
-// CHECK: StructDecl=:24:3 (Definition) [type=struct (anonymous at {{.*}}print-type.c:24:3)] [typekind=Record] [isPOD=1] [nbFields=2] [isAnon=1] [isAnonRecDecl=1]
+// CHECK: StructDecl=(unnamed struct at {{.*}}:18:1):18:1 (Definition) [type=struct (anonymous at {{.*}}print-type.c:18:1)] [typekind=Record] [isPOD=1] [nbFields=2] [isAnon=1] [isAnonRecDecl=0]
+// CHECK: StructDecl=(unnamed struct at {{.*}}:23:1):23:1 (Definition) [type=struct (anonymous at {{.*}}print-type.c:23:1)] [typekind=Record] [isPOD=1] [nbFields=1] [isAnon=1] [isAnonRecDecl=0]
+// CHECK: StructDecl=(anonymous struct at {{.*}}:24:3):24:3 (Definition) [type=struct (anonymous at {{.*}}print-type.c:24:3)] [typekind=Record] [isPOD=1] [nbFields=2] [isAnon=1] [isAnonRecDecl=1]
// CHECK: FieldDecl=x:25:17 (Definition) [type=_Atomic(int)] [typekind=Atomic] [valuetype=int] [valuetypekind=Int] [isPOD=0] [isAnonRecDecl=0]
// CHECK: FieldDecl=y:26:9 (Definition) [type=int] [typekind=Int] [isPOD=1] [isAnonRecDecl=0]
-// CHECK: StructDecl=:30:10 (Definition) [type=struct (anonymous at {{.*}}print-type.c:30:10)] [typekind=Record] [isPOD=1] [nbFields=2] [isAnon=1] [isAnonRecDecl=0]
+// CHECK: StructDecl=(unnamed struct at {{.*}}:30:10):30:10 (Definition) [type=struct (anonymous at {{.*}}print-type.c:30:10)] [typekind=Record] [isPOD=1] [nbFields=2] [isAnon=1] [isAnonRecDecl=0]
// CHECK: VarDecl=aul:32:24 [type=_Atomic(unsigned long)] [typekind=Atomic] [valuetype=unsigned long] [valuetypekind=ULong] [isPOD=0] [isAnonRecDecl=0]
Index: clang/test/Index/print-bitwidth.c
===================================================================
--- clang/test/Index/print-bitwidth.c
+++ clang/test/Index/print-bitwidth.c
@@ -15,9 +15,9 @@
// RUN: c-index-test -test-print-bitwidth %s | FileCheck %s
// CHECK: FieldDecl=ac:2:12 (Definition) bitwidth=4
-// CHECK: FieldDecl=:3:3 (Definition) bitwidth=4
+// CHECK: FieldDecl=(unnamed field at {{.*}}:3:3 of type unsigned int):3:3 (Definition) bitwidth=4
// CHECK: FieldDecl=clock:4:12 (Definition) bitwidth=1
-// CHECK: FieldDecl=:5:3 (Definition) bitwidth=0
+// CHECK: FieldDecl=(unnamed field at {{.*}}:5:3 of type unsigned int):5:3 (Definition) bitwidth=0
// CHECK: FieldDecl=flag:6:12 (Definition) bitwidth=1
// CHECK: FieldDecl=light:10:12 (Definition) bitwidth=1
// CHECK: FieldDecl=toaster:11:12 (Definition) bitwidth=1
Index: clang/test/Index/preamble.c
===================================================================
--- clang/test/Index/preamble.c
+++ clang/test/Index/preamble.c
@@ -20,7 +20,7 @@
// CHECK: preamble.h:4:9: DeclRefExpr=ptr1:3:10 Extent=[4:9 - 4:13]
// CHECK: preamble.h:5:10: IntegerLiteral= Extent=[5:10 - 5:11]
// CHECK: preamble.c:8:5: FunctionDecl=wibble:8:5 Extent=[8:1 - 8:16]
-// CHECK: preamble.c:8:15: ParmDecl=:8:15 (Definition) Extent=[8:12 - 8:15]
+// CHECK: preamble.c:8:15: ParmDecl=(unnamed variable at {{.*}}:8:15 of type int):8:15 (Definition) Extent=[8:12 - 8:15]
// CHECK-DIAG: preamble.h:4:7:{4:9-4:13}: warning: incompatible pointer types assigning to 'int *' from 'float *'
// FIXME: Should see:
// preamble.c:5:9: warning: macro is not used
Index: clang/test/Index/load-namespaces.cpp
===================================================================
--- clang/test/Index/load-namespaces.cpp
+++ clang/test/Index/load-namespaces.cpp
@@ -40,7 +40,7 @@
// CHECK: load-namespaces.cpp:16:17: NamespaceRef=std0x:14:11 Extent=[16:17 - 16:22]
// CHECK: load-namespaces.cpp:18:11: Namespace=std:18:11 (Definition) Extent=[18:1 - 20:2]
// CHECK: load-namespaces.cpp:19:7: FunctionDecl=g:19:7 Extent=[19:3 - 19:13]
-// CHECK: load-namespaces.cpp:19:12: ParmDecl=:19:12 (Definition) Extent=[19:9 - 19:12]
+// CHECK: load-namespaces.cpp:19:12: ParmDecl=(unnamed variable at {{.*}}:19:12 of type int):19:12 (Definition) Extent=[19:9 - 19:12]
// CHECK: load-namespaces.cpp:22:12: UsingDeclaration=g[19:7, 10:8] Extent=[22:1 - 22:13]
// CHECK: load-namespaces.cpp:22:7: NamespaceRef=std:18:11 Extent=[22:7 - 22:10]
// CHECK: load-namespaces.cpp:24:11: FunctionDecl=g:24:11 (Definition) Extent=[24:1 - 25:2]
Index: clang/test/Index/load-decls.c
===================================================================
--- clang/test/Index/load-decls.c
+++ clang/test/Index/load-decls.c
@@ -17,6 +17,6 @@
// CHECK: load-decls.c:6:11: DeclRefExpr=Red:2:3 Extent=[6:11 - 6:14]
//
// CHECK: load-decls.c:9:6: FunctionDecl=PR17970:9:6 Extent=[9:1 - 9:35]
-// CHECK: load-decls.c:9:21: ParmDecl=:9:21 (Definition) Extent=[9:14 - 9:27]
-// CHECK: load-decls.c:9:26: ParmDecl=:9:26 (Definition) Extent=[9:23 - 9:26]
-// CHECK: load-decls.c:9:34: ParmDecl=:9:34 (Definition) Extent=[9:29 - 9:34]
+// CHECK: load-decls.c:9:21: ParmDecl=(unnamed variable at {{.*}}:9:21 of type void (*)(int)):9:21 (Definition) Extent=[9:14 - 9:27]
+// CHECK: load-decls.c:9:26: ParmDecl=(unnamed variable at {{.*}}:9:26 of type int):9:26 (Definition) Extent=[9:23 - 9:26]
+// CHECK: load-decls.c:9:34: ParmDecl=(unnamed variable at {{.*}}:9:34 of type float):9:34 (Definition) Extent=[9:29 - 9:34]
Index: clang/test/Index/linkage.c
===================================================================
--- clang/test/Index/linkage.c
+++ clang/test/Index/linkage.c
@@ -30,7 +30,7 @@
// CHECK: VarDecl=k:9:7 (Definition)linkage=NoLinkage
// CHECK: VarDecl=n:11:12linkage=External
// CHECK: FunctionDecl=wibble:12:12linkage=Internal
-// CHECK: ParmDecl=:12:22 (Definition)linkage=NoLinkage
+// CHECK: ParmDecl=(unnamed variable at {{.*}}:12:22 of type int):12:22 (Definition)linkage=NoLinkage
// CHECK: FunctionDecl=ena:14:6linkage=External
// CHECK: ParmDecl=dio:14:16 (Definition)linkage=NoLinkage
// CHECK: ParmDecl=tria:14:25 (Definition)linkage=NoLinkage
Index: clang/test/Index/c-index-getCursor-test.m
===================================================================
--- clang/test/Index/c-index-getCursor-test.m
+++ clang/test/Index/c-index-getCursor-test.m
@@ -102,9 +102,9 @@
// CHECK: [36:7 - 36:21] ObjCInstanceMethodDecl=bazMethod:36:1
// CHECK: [36:21 - 38:5] ObjCInterfaceDecl=Baz:31:12
// CHECK: [38:5 - 40:1] Invalid Cursor => NoDeclFound
-// CHECK: [40:1 - 41:3] EnumDecl=:40:1 (Definition)
+// CHECK: [40:1 - 41:3] EnumDecl=(unnamed enum at {{.*}}:40:1):40:1 (Definition)
// CHECK: [41:3 - 41:11] EnumConstantDecl=someEnum:41:3 (Definition)
-// CHECK: [41:11 - 42:2] EnumDecl=:40:1 (Definition)
+// CHECK: [41:11 - 42:2] EnumDecl=(unnamed enum at {{.*}}:40:1):40:1 (Definition)
// CHECK: [42:2 - 44:1] Invalid Cursor => NoDeclFound
// CHECK: [44:1 - 44:11] FunctionDecl=main:44:5 (Definition)
// CHECK: [44:11 - 44:19] ParmDecl=argc:44:15 (Definition)
Index: clang/test/Index/c-index-api-loadTU-test.m
===================================================================
--- clang/test/Index/c-index-api-loadTU-test.m
+++ clang/test/Index/c-index-api-loadTU-test.m
@@ -105,7 +105,7 @@
// CHECK: c-index-api-loadTU-test.m:35:9: ObjCIvarDecl=_anIVar:35:9 (Definition) Extent=[35:5 - 35:16]
// CHECK: c-index-api-loadTU-test.m:38:11: ObjCInstanceMethodDecl=bazMethod:38:11 Extent=[38:1 - 38:21]
// CHECK: c-index-api-loadTU-test.m:38:4: ObjCClassRef=Foo:4:12 Extent=[38:4 - 38:7]
-// CHECK: c-index-api-loadTU-test.m:42:1: EnumDecl=:42:1 (Definition) Extent=[42:1 - 44:2]
+// CHECK: c-index-api-loadTU-test.m:42:1: EnumDecl=(unnamed enum at {{.*}}:42:1):42:1 (Definition) Extent=[42:1 - 44:2]
// CHECK: c-index-api-loadTU-test.m:43:3: EnumConstantDecl=someEnum:43:3 (Definition) Extent=[43:3 - 43:11]
// CHECK: c-index-api-loadTU-test.m:46:5: FunctionDecl=main:46:5 (Definition) Extent=[46:1 - 55:2]
// CHECK: c-index-api-loadTU-test.m:46:15: ParmDecl=argc:46:15 (Definition) Extent=[46:11 - 46:19]
Index: clang/test/Index/annotate-tokens.cpp
===================================================================
--- clang/test/Index/annotate-tokens.cpp
+++ clang/test/Index/annotate-tokens.cpp
@@ -77,7 +77,7 @@
// CHECK: Keyword: "operator" [9:5 - 9:13] CXXMethod=operator++:9:5
// CHECK: Punctuation: "++" [9:13 - 9:15] CXXMethod=operator++:9:5
// CHECK: Punctuation: "(" [9:15 - 9:16] CXXMethod=operator++:9:5
-// CHECK: Keyword: "int" [9:16 - 9:19] ParmDecl=:9:19 (Definition
+// CHECK: Keyword: "int" [9:16 - 9:19] ParmDecl=(unnamed variable at {{.*}}:9:19 of type int):9:19 (Definition
// CHECK: Punctuation: ")" [9:19 - 9:20] CXXMethod=operator++:9:5
// CHECK: Punctuation: ";" [9:20 - 9:21] StructDecl=X:7:8 (Definition)
// CHECK: Punctuation: "}" [10:1 - 10:2] StructDecl=X:7:8 (Definition)
@@ -148,7 +148,7 @@
// CHECK: Punctuation: ")" [23:21 - 23:22] NonTypeTemplateParameter=tfn:23:18 (Definition)
// CHECK: Punctuation: "(" [23:22 - 23:23] NonTypeTemplateParameter=tfn:23:18 (Definition)
// CHECK: Identifier: "X" [23:23 - 23:24] TypeRef=struct X:7:8
-// CHECK: Punctuation: "*" [23:24 - 23:25] ParmDecl=:23:25 (Definition)
+// CHECK: Punctuation: "*" [23:24 - 23:25] ParmDecl=(unnamed variable at {{.*}}:23:25 of type X *):23:25 (Definition)
// CHECK: Punctuation: ")" [23:25 - 23:26] NonTypeTemplateParameter=tfn:23:18 (Definition)
// CHECK: Punctuation: ">" [23:26 - 23:27] ClassTemplate=TS:24:8 (Definition)
// CHECK: Keyword: "struct" [24:1 - 24:7] ClassTemplate=TS:24:8 (Definition)
@@ -170,7 +170,7 @@
// CHECK: Punctuation: ")" [28:21 - 28:22] NonTypeTemplateParameter=tfn:28:18 (Definition)
// CHECK: Punctuation: "(" [28:22 - 28:23] NonTypeTemplateParameter=tfn:28:18 (Definition)
// CHECK: Identifier: "X" [28:23 - 28:24] TypeRef=struct X:7:8
-// CHECK: Punctuation: "*" [28:24 - 28:25] ParmDecl=:28:25 (Definition)
+// CHECK: Punctuation: "*" [28:24 - 28:25] ParmDecl=(unnamed variable at {{.*}}:28:25 of type X *):28:25 (Definition)
// CHECK: Punctuation: ")" [28:25 - 28:26] NonTypeTemplateParameter=tfn:28:18 (Definition)
// CHECK: Punctuation: ">" [28:26 - 28:27] CXXMethod=foo:29:15 (Definition)
// CHECK: Keyword: "void" [29:1 - 29:5] CXXMethod=foo:29:15 (Definition)
Index: clang/test/Index/annotate-comments-typedef.m
===================================================================
--- clang/test/Index/annotate-comments-typedef.m
+++ clang/test/Index/annotate-comments-typedef.m
@@ -36,7 +36,7 @@
int iii;
} Foo;
// CHECK: TypedefDecl=Foo:[[@LINE-1]]:11 (Definition) {{.*}} FullCommentAsHTML=[<p class="para-brief"> Comment about Foo </p>] FullCommentAsXML=[<Typedef file="{{[^"]+}}annotate-comments-typedef.m" line="[[@LINE-1]]" column="11"><Name>Foo</Name><USR>c:@T@Foo</USR><Declaration>typedef struct Foo Foo</Declaration><Abstract><Para> Comment about Foo </Para></Abstract></Typedef>]
-// CHECK: StructDecl=:[[@LINE-4]]:9 (Definition) {{.*}} BriefComment=[Comment about Foo] FullCommentAsHTML=[<p class="para-brief"> Comment about Foo </p>] FullCommentAsXML=[<Class file="{{[^"]+}}annotate-comments-typedef.m" line="[[@LINE-4]]" column="9"><Name><anonymous></Name><USR>c:@SA@Foo</USR><Declaration>struct {}</Declaration><Abstract><Para> Comment about Foo </Para></Abstract></Class>]
+// CHECK: StructDecl=(unnamed struct at {{.*}}:[[@LINE-4]]:9):[[@LINE-4]]:9 (Definition) {{.*}} BriefComment=[Comment about Foo] FullCommentAsHTML=[<p class="para-brief"> Comment about Foo </p>] FullCommentAsXML=[<Class file="{{[^"]+}}annotate-comments-typedef.m" line="[[@LINE-4]]" column="9"><Name><anonymous></Name><USR>c:@SA@Foo</USR><Declaration>struct {}</Declaration><Abstract><Para> Comment about Foo </Para></Abstract></Class>]
struct Foo1 {
Index: clang/test/CXX/special/class.dtor/p5-0x.cpp
===================================================================
--- clang/test/CXX/special/class.dtor/p5-0x.cpp
+++ clang/test/CXX/special/class.dtor/p5-0x.cpp
@@ -63,16 +63,15 @@
B4 b4; // expected-error {{deleted function}}
union B5 {
B5();
- // FIXME: Describe the anonymous union member better than ''.
- union { // expected-note {{because field '' has a deleted destructor}}
- DeletedDtor a; // expected-note {{because field 'a' has a deleted destructor}}
+ union { // expected-note-re {{because field '(unnamed field of type B5::(anonymous union at {{.*}}:66:3))' has a deleted destructor}}
+ DeletedDtor a; // expected-note-re {{destructor of '(anonymous union at {{.*}}:66:3)' is implicitly deleted because field 'a' has a deleted destructor}}
};
};
B5 b5; // expected-error {{deleted function}}
union B6 {
B6();
- union { // expected-note {{because field '' has a deleted destructor}}
- InaccessibleDtor a; // expected-note {{because field 'a' has an inaccessible destructor}}
+ union { // expected-note-re {{because field '(unnamed field of type B6::(anonymous union at {{.*}}:73:3))' has a deleted destructor}}
+ InaccessibleDtor a; // expected-note-re {{destructor of '(anonymous union at {{.*}}:73:3)' is implicitly deleted because field 'a' has an inaccessible destructor}}
};
};
B6 b6; // expected-error {{deleted function}}
Index: clang/test/Analysis/explain-svals.cpp
===================================================================
--- clang/test/Analysis/explain-svals.cpp
+++ clang/test/Analysis/explain-svals.cpp
@@ -98,7 +98,7 @@
} // end of anonymous namespace
void test_6() {
- clang_analyzer_explain(conjure_S()); // expected-warning-re{{{{^lazily frozen compound value of 1st parameter of function 'clang_analyzer_explain\(\)'$}}}}
+ clang_analyzer_explain(conjure_S()); // expected-warning-re{{{{^lazily frozen compound value of parameter '\(unnamed variable at .*:23:30 of type S\)'$}}}}
clang_analyzer_explain(conjure_S().z); // expected-warning-re{{{{^value derived from \(symbol of type 'int' conjured at statement 'conjure_S\(\)'\) for field 'z' of temporary object constructed at statement 'conjure_S\(\)'$}}}}
}
Index: clang/test/AST/ast-dump-record-definition-data-json.cpp
===================================================================
--- clang/test/AST/ast-dump-record-definition-data-json.cpp
+++ clang/test/AST/ast-dump-record-definition-data-json.cpp
@@ -323,7 +323,7 @@
// CHECK-NEXT: },
// CHECK-NEXT: "isImplicit": true,
// CHECK-NEXT: "isReferenced": true,
-// CHECK-NEXT: "name": "~",
+// CHECK-NEXT: "name": "~(unnamed class at {{.*}}:4:29)",
// CHECK-NEXT: "mangledName": "_ZZ1fvEN3$_0D1Ev",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void () noexcept"
@@ -708,7 +708,7 @@
// CHECK-NEXT: },
// CHECK-NEXT: "isImplicit": true,
// CHECK-NEXT: "isReferenced": true,
-// CHECK-NEXT: "name": "~",
+// CHECK-NEXT: "name": "~(unnamed class at {{.*}}:5:26)",
// CHECK-NEXT: "mangledName": "_ZZ1fvEN3$_1D1Ev",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void () noexcept"
Index: clang/test/AST/ast-dump-APValue-anon-union.cpp
===================================================================
--- clang/test/AST/ast-dump-APValue-anon-union.cpp
+++ clang/test/AST/ast-dump-APValue-anon-union.cpp
@@ -40,13 +40,13 @@
constexpr U0 u0b{3.1415f};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0b 'const U0' constexpr listinit
- // CHECK-NEXT: | |-value: Union . Union .f Float 3.141500e+00
+ // CHECK-NEXT: | |-value: Union .(unnamed field of type U0::(anonymous union at {{.*}}:20:3)) Union .f Float 3.141500e+00
constexpr U1 u1a{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1a 'const U1' constexpr listinit
- // CHECK-NEXT: | |-value: Union . Union .f Float 0.000000e+00
+ // CHECK-NEXT: | |-value: Union .(unnamed field of type U1::(anonymous union at {{.*}}:26:3)) Union .f Float 0.000000e+00
constexpr U1 u1b{3.1415f};
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1b 'const U1' constexpr listinit
- // CHECK-NEXT: |-value: Union . Union .f Float 3.141500e+00
+ // CHECK-NEXT: |-value: Union .(unnamed field of type U1::(anonymous union at {{.*}}:26:3)) Union .f Float 3.141500e+00
}
Index: clang/lib/Sema/SemaDecl.cpp
===================================================================
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -4977,6 +4977,9 @@
const PrintingPolicy &Policy) {
DeclContext *Owner = Record->getDeclContext();
+ // Mark this as an anonymous struct/union type.
+ Record->setAnonymousStructOrUnion(true);
+
// Diagnose whether this anonymous struct/union is an extension.
if (Record->isUnion() && !getLangOpts().CPlusPlus && !getLangOpts().C11)
Diag(Record->getLocation(), diag::ext_anonymous_union);
@@ -5205,9 +5208,6 @@
}
Anon->setImplicit();
- // Mark this as an anonymous struct/union type.
- Record->setAnonymousStructOrUnion(true);
-
// Add the anonymous struct/union object to the current
// context. We'll be referencing this object when we refer to one of
// its members.
Index: clang/lib/AST/Decl.cpp
===================================================================
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -2015,6 +2015,84 @@
return DeclaratorDecl::getSourceRange();
}
+static void printPresumedLocationAt(raw_ostream &OS, const SourceManager &SM,
+ const PrintingPolicy &Policy,
+ SourceLocation Loc) {
+ PresumedLoc PLoc = SM.getPresumedLoc(Loc);
+ if (PLoc.isValid()) {
+ OS << " at ";
+ StringRef File = PLoc.getFilename();
+ if (Policy.Callbacks)
+ OS << Policy.Callbacks->remapPath(File);
+ else
+ OS << File;
+ OS << ':' << PLoc.getLine() << ':' << PLoc.getColumn();
+ }
+}
+
+static void printUnnamedTag(raw_ostream &OS, const ASTContext &Ctx,
+ const TagDecl *TD, bool IsAnonymousStructOrUnion) {
+ assert(TD && "missing TagDecl!");
+ assert(!TD->getDeclName() && "expected an unnamed declaration!");
+ const PrintingPolicy &Policy = Ctx.getPrintingPolicy();
+
+ // The following mirrors the code in TypePrinter::printTag.
+ //
+ // Note that we try to be precise with the terms "anonymous" and "unnamed".
+ // We may however issue a diagnostic for an anonymous record before actually
+ // knowning that it is an anonymous record. In this case the term "unnamed"
+ // will be mistakenly used (since the default is to assume that the record
+ // is not anonymous). This is a relatively uncommon case and therefore the
+ // additional complexity needed to prevent this is not worthwhile.
+ OS << Policy.getOpenDelimiter()
+ << (IsAnonymousStructOrUnion ? "anonymous " : "unnamed ")
+ << TD->getKindName();
+
+ if (Policy.AnonymousTagLocations)
+ printPresumedLocationAt(OS, Ctx.getSourceManager(), Policy,
+ TD->getLocation());
+
+ OS << Policy.getCloseDelimiter();
+}
+
+static void printUnnamedDeclarator(raw_ostream &OS, const ASTContext &Ctx,
+ const DeclaratorDecl *DD) {
+ assert(DD && "missing DeclaratorDecl!");
+ assert(!DD->getDeclName() && "expected an unnamed declaration!");
+ assert(isa<FieldDecl>(DD) ||
+ isa<VarDecl>(DD) && "expected a field or variable declaration!");
+ const PrintingPolicy &Policy = Ctx.getPrintingPolicy();
+
+ OS << Policy.getOpenDelimiter() << "unnamed "
+ << (isa<FieldDecl>(DD) ? "field" : "variable");
+
+ // Don't print the location of anonymous records twice.
+ bool SuppressLocation = false;
+ if (const auto *TagTy = DD->getType()->getAs<TagType>()) {
+ const TagDecl *TD = TagTy->getDecl();
+ SuppressLocation =
+ !TD->getDeclName() && DD->getLocation() == DD->getTypeSpecStartLoc();
+ }
+
+ // FIXME: For now we are using PrintingPolicy::AnonymousTagLocations but
+ // perhaps we should add another flag.
+ if (Policy.AnonymousTagLocations && !SuppressLocation)
+ printPresumedLocationAt(OS, Ctx.getSourceManager(), Policy,
+ DD->getLocation());
+
+ OS << " of type ";
+ DD->getType().print(OS, Policy);
+
+ OS << Policy.getCloseDelimiter();
+}
+
+void VarDecl::printName(raw_ostream &OS) const {
+ if (!getDeclName())
+ return printUnnamedDeclarator(OS, getASTContext(), this);
+
+ DeclaratorDecl::printName(OS);
+}
+
template<typename T>
static LanguageLinkage getDeclLanguageLinkage(const T &D) {
// C++ [dcl.link]p1: All function types, function names with external linkage,
@@ -4117,6 +4195,13 @@
return DeclaratorDecl::getSourceRange();
}
+void FieldDecl::printName(raw_ostream &OS) const {
+ if (!getDeclName())
+ return printUnnamedDeclarator(OS, getASTContext(), this);
+
+ DeclaratorDecl::printName(OS);
+}
+
void FieldDecl::setCapturedVLAType(const VariableArrayType *VLAType) {
assert((getParent()->isLambda() || getParent()->isCapturedRecord()) &&
"capturing type in non-lambda or captured record.");
@@ -4286,6 +4371,14 @@
return Enum;
}
+void EnumDecl::printName(raw_ostream &OS) const {
+ if (!getDeclName())
+ return printUnnamedTag(OS, getASTContext(), this,
+ /*IsAnonymousStructOrUnion=*/false);
+
+ TagDecl::printName(OS);
+}
+
SourceRange EnumDecl::getIntegerTypeRange() const {
if (const TypeSourceInfo *TI = getIntegerTypeSourceInfo())
return TI->getTypeLoc().getSourceRange();
@@ -4420,6 +4513,14 @@
return R;
}
+void RecordDecl::printName(raw_ostream &OS) const {
+ if (!getDeclName())
+ return printUnnamedTag(OS, getASTContext(), this,
+ isAnonymousStructOrUnion());
+
+ TagDecl::printName(OS);
+}
+
bool RecordDecl::isInjectedClassName() const {
return isImplicit() && getDeclName() && getDeclContext()->isRecord() &&
cast<RecordDecl>(getDeclContext())->getDeclName() == getDeclName();
Index: clang/include/clang/AST/PrettyPrinter.h
===================================================================
--- clang/include/clang/AST/PrettyPrinter.h
+++ clang/include/clang/AST/PrettyPrinter.h
@@ -75,6 +75,9 @@
UseVoidForZeroParams = false;
}
+ char getOpenDelimiter() const { return MSVCFormatting ? '`' : '('; }
+ char getCloseDelimiter() const { return MSVCFormatting ? '\'' : ')'; }
+
/// The number of spaces to use to indent each line.
unsigned Indentation : 8;
Index: clang/include/clang/AST/Decl.h
===================================================================
--- clang/include/clang/AST/Decl.h
+++ clang/include/clang/AST/Decl.h
@@ -1024,6 +1024,8 @@
SourceRange getSourceRange() const override LLVM_READONLY;
+ void printName(raw_ostream &OS) const override;
+
/// Returns the storage class as written in the source. For the
/// computed linkage of symbol, see getLinkage.
StorageClass getStorageClass() const {
@@ -2945,6 +2947,8 @@
SourceRange getSourceRange() const override LLVM_READONLY;
+ void printName(raw_ostream &OS) const override;
+
/// Retrieves the canonical declaration of this field.
FieldDecl *getCanonicalDecl() override { return getFirstDecl(); }
const FieldDecl *getCanonicalDecl() const { return getFirstDecl(); }
@@ -3612,6 +3616,8 @@
bool IsFixed);
static EnumDecl *CreateDeserialized(ASTContext &C, unsigned ID);
+ void printName(raw_ostream &OS) const override;
+
/// When created, the EnumDecl corresponds to a
/// forward-declared enum. This method is used to mark the
/// declaration as being defined; its enumerators have already been
@@ -3806,6 +3812,8 @@
IdentifierInfo *Id, RecordDecl* PrevDecl = nullptr);
static RecordDecl *CreateDeserialized(const ASTContext &C, unsigned ID);
+ void printName(raw_ostream &OS) const override;
+
RecordDecl *getPreviousDecl() {
return cast_or_null<RecordDecl>(
static_cast<TagDecl *>(this)->getPreviousDecl());
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits