Skip to content

Commit e38f4f6

Browse files
committed
Revert "[clang] improve print / dump of anonymous declarations (#124605)"
This reverts commit f949f87. This commit introduces an llvm_unreachable call that is actually reachable. I posted a reproducer on the pull request discussion.
1 parent 48df948 commit e38f4f6

20 files changed

+286
-334
lines changed

clang/lib/AST/StmtPrinter.cpp

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,42 +1257,28 @@ void StmtPrinter::VisitConstantExpr(ConstantExpr *Node) {
12571257
}
12581258

12591259
void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
1260-
ValueDecl *VD = Node->getDecl();
1261-
if (const auto *OCED = dyn_cast<OMPCapturedExprDecl>(VD)) {
1260+
if (const auto *OCED = dyn_cast<OMPCapturedExprDecl>(Node->getDecl())) {
12621261
OCED->getInit()->IgnoreImpCasts()->printPretty(OS, nullptr, Policy);
12631262
return;
12641263
}
1265-
if (const auto *TPOD = dyn_cast<TemplateParamObjectDecl>(VD)) {
1264+
if (const auto *TPOD = dyn_cast<TemplateParamObjectDecl>(Node->getDecl())) {
12661265
TPOD->printAsExpr(OS, Policy);
12671266
return;
12681267
}
12691268
if (NestedNameSpecifier *Qualifier = Node->getQualifier())
12701269
Qualifier->print(OS, Policy);
12711270
if (Node->hasTemplateKeyword())
12721271
OS << "template ";
1273-
DeclarationNameInfo NameInfo = Node->getNameInfo();
1274-
if (IdentifierInfo *ID = NameInfo.getName().getAsIdentifierInfo();
1275-
ID || NameInfo.getName().getNameKind() != DeclarationName::Identifier) {
1276-
if (Policy.CleanUglifiedParameters &&
1277-
isa<ParmVarDecl, NonTypeTemplateParmDecl>(VD) && ID)
1278-
OS << ID->deuglifiedName();
1279-
else
1280-
NameInfo.printName(OS, Policy);
1281-
} else {
1282-
switch (VD->getKind()) {
1283-
case Decl::NonTypeTemplateParm: {
1284-
auto *TD = cast<NonTypeTemplateParmDecl>(VD);
1285-
OS << "value-parameter-" << TD->getDepth() << '-' << TD->getIndex() << "";
1286-
break;
1287-
}
1288-
default:
1289-
llvm_unreachable("Unhandled anonymous declaration kind");
1290-
}
1291-
}
1272+
if (Policy.CleanUglifiedParameters &&
1273+
isa<ParmVarDecl, NonTypeTemplateParmDecl>(Node->getDecl()) &&
1274+
Node->getDecl()->getIdentifier())
1275+
OS << Node->getDecl()->getIdentifier()->deuglifiedName();
1276+
else
1277+
Node->getNameInfo().printName(OS, Policy);
12921278
if (Node->hasExplicitTemplateArgs()) {
12931279
const TemplateParameterList *TPL = nullptr;
12941280
if (!Node->hadMultipleCandidates())
1295-
if (auto *TD = dyn_cast<TemplateDecl>(VD))
1281+
if (auto *TD = dyn_cast<TemplateDecl>(Node->getDecl()))
12961282
TPL = TD->getTemplateParameters();
12971283
printTemplateArgumentList(OS, Node->template_arguments(), Policy, TPL);
12981284
}

clang/lib/AST/TextNodeDumper.cpp

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -901,41 +901,7 @@ void TextNodeDumper::dumpBareDeclRef(const Decl *D) {
901901

902902
if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
903903
ColorScope Color(OS, ShowColors, DeclNameColor);
904-
if (DeclarationName Name = ND->getDeclName())
905-
OS << " '" << Name << '\'';
906-
else
907-
switch (ND->getKind()) {
908-
case Decl::Decomposition: {
909-
auto *DD = cast<DecompositionDecl>(ND);
910-
OS << " first_binding '" << DD->bindings()[0]->getDeclName() << '\'';
911-
break;
912-
}
913-
case Decl::Field: {
914-
auto *FD = cast<FieldDecl>(ND);
915-
OS << " field_index " << FD->getFieldIndex();
916-
break;
917-
}
918-
case Decl::ParmVar: {
919-
auto *PD = cast<ParmVarDecl>(ND);
920-
OS << " depth " << PD->getFunctionScopeDepth() << " index "
921-
<< PD->getFunctionScopeIndex();
922-
break;
923-
}
924-
case Decl::TemplateTypeParm: {
925-
auto *TD = cast<TemplateTypeParmDecl>(ND);
926-
OS << " depth " << TD->getDepth() << " index " << TD->getIndex();
927-
break;
928-
}
929-
case Decl::NonTypeTemplateParm: {
930-
auto *TD = cast<NonTypeTemplateParmDecl>(ND);
931-
OS << " depth " << TD->getDepth() << " index " << TD->getIndex();
932-
break;
933-
}
934-
default:
935-
// Var, Namespace, (CXX)Record: Nothing else besides source location.
936-
dumpSourceRange(ND->getSourceRange());
937-
break;
938-
}
904+
OS << " '" << ND->getDeclName() << '\'';
939905
}
940906

941907
if (const ValueDecl *VD = dyn_cast<ValueDecl>(D))

clang/test/AST/HLSL/StructuredBuffers-AST.hlsl

Lines changed: 222 additions & 222 deletions
Large diffs are not rendered by default.

clang/test/AST/HLSL/TypedBuffers-AST.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// EMPTY-NEXT: ImplicitConceptSpecializationDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc>
2424
// EMPTY-NEXT: TemplateArgument type 'type-parameter-0-0'
2525
// EMPTY-NEXT: TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'type-parameter-0-0' dependent depth 0 index 0
26-
// EMPTY-NEXT: TemplateTypeParm 0x{{[0-9A-Fa-f]+}} depth 0 index 0
26+
// EMPTY-NEXT: TemplateTypeParm 0x{{[0-9A-Fa-f]+}} ''
2727
// EMPTY-NEXT: TemplateArgument type 'element_type':'type-parameter-0-0'
2828
// EMPTY-NEXT: TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'element_type' dependent depth 0 index 0
2929
// EMPTY-NEXT: TemplateTypeParm 0x{{[0-9A-Fa-f]+}} 'element_type'
@@ -45,7 +45,7 @@ RESOURCE<float> Buffer;
4545
// CHECK-NEXT: ImplicitConceptSpecializationDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc>
4646
// CHECK-NEXT: TemplateArgument type 'type-parameter-0-0'
4747
// CHECK-NEXT: TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'type-parameter-0-0' dependent depth 0 index 0
48-
// CHECK-NEXT: TemplateTypeParm 0x{{[0-9A-Fa-f]+}} depth 0 index 0
48+
// CHECK-NEXT: TemplateTypeParm 0x{{[0-9A-Fa-f]+}} ''
4949
// CHECK-NEXT: TemplateArgument type 'element_type':'type-parameter-0-0'
5050
// CHECK-NEXT: TemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'element_type' dependent depth 0 index 0
5151
// CHECK-NEXT: TemplateTypeParm 0x{{[0-9A-Fa-f]+}} 'element_type'

clang/test/AST/ast-dump-decl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ struct testIndirectFieldDecl {
121121
};
122122
};
123123
// CHECK: IndirectFieldDecl{{.*}} TestIndirectFieldDecl 'int'
124-
// CHECK-NEXT: Field{{.*}} field_index 0
124+
// CHECK-NEXT: Field{{.*}} ''
125125
// CHECK-NEXT: Field{{.*}} 'TestIndirectFieldDecl'
126126

127127
// FIXME: It would be nice to dump the enum and its enumerators.

clang/test/AST/ast-dump-records.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ struct C {
5858
};
5959
// CHECK-NEXT: FieldDecl 0x{{[^ ]*}} <line:[[@LINE-7]]:3> col:3 implicit 'union C::(anonymous at {{.*}}:[[@LINE-7]]:3)'
6060
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <line:[[@LINE-6]]:9> col:9 implicit c 'int'
61-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 1 'union C::(anonymous at {{.*}}:[[@LINE-9]]:3)'
61+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'union C::(anonymous at {{.*}}:[[@LINE-9]]:3)'
6262
// CHECK-NEXT: Field 0x{{[^ ]*}} 'c' 'int'
6363
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <line:[[@LINE-7]]:11> col:11 implicit d 'float'
64-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 1 'union C::(anonymous at {{.*}}:[[@LINE-12]]:3)'
64+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'union C::(anonymous at {{.*}}:[[@LINE-12]]:3)'
6565
// CHECK-NEXT: Field 0x{{[^ ]*}} 'd' 'float'
6666

6767
struct {
@@ -72,10 +72,10 @@ struct C {
7272
};
7373
// CHECK-NEXT: FieldDecl 0x{{[^ ]*}} <line:[[@LINE-6]]:3> col:3 implicit 'struct C::(anonymous at {{.*}}:[[@LINE-6]]:3)'
7474
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <line:[[@LINE-5]]:9> col:9 implicit e 'int'
75-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 2 'struct C::(anonymous at {{.*}}:[[@LINE-8]]:3)'
75+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'struct C::(anonymous at {{.*}}:[[@LINE-8]]:3)'
7676
// CHECK-NEXT: Field 0x{{[^ ]*}} 'e' 'int'
7777
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <col:12> col:12 implicit f 'int'
78-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 2 'struct C::(anonymous at {{.*}}:[[@LINE-11]]:3)'
78+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'struct C::(anonymous at {{.*}}:[[@LINE-11]]:3)'
7979
// CHECK-NEXT: Field 0x{{[^ ]*}} 'f' 'int'
8080
};
8181

@@ -141,10 +141,10 @@ union G {
141141
};
142142
// CHECK-NEXT: FieldDecl 0x{{[^ ]*}} <line:[[@LINE-7]]:3> col:3 implicit 'union G::(anonymous at {{.*}}:[[@LINE-7]]:3)'
143143
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <line:[[@LINE-6]]:9> col:9 implicit c 'int'
144-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 1 'union G::(anonymous at {{.*}}:[[@LINE-9]]:3)'
144+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'union G::(anonymous at {{.*}}:[[@LINE-9]]:3)'
145145
// CHECK-NEXT: Field 0x{{[^ ]*}} 'c' 'int'
146146
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <line:[[@LINE-7]]:11> col:11 implicit d 'float'
147-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 1 'union G::(anonymous at {{.*}}:[[@LINE-12]]:3)'
147+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'union G::(anonymous at {{.*}}:[[@LINE-12]]:3)'
148148
// CHECK-NEXT: Field 0x{{[^ ]*}} 'd' 'float'
149149

150150
struct {
@@ -155,10 +155,10 @@ union G {
155155
};
156156
// CHECK-NEXT: FieldDecl 0x{{[^ ]*}} <line:[[@LINE-6]]:3> col:3 implicit 'struct G::(anonymous at {{.*}}:[[@LINE-6]]:3)'
157157
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <line:[[@LINE-5]]:9> col:9 implicit e 'int'
158-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 2 'struct G::(anonymous at {{.*}}:[[@LINE-8]]:3)'
158+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'struct G::(anonymous at {{.*}}:[[@LINE-8]]:3)'
159159
// CHECK-NEXT: Field 0x{{[^ ]*}} 'e' 'int'
160160
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <col:12> col:12 implicit f 'int'
161-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 2 'struct G::(anonymous at {{.*}}:[[@LINE-11]]:3)'
161+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'struct G::(anonymous at {{.*}}:[[@LINE-11]]:3)'
162162
// CHECK-NEXT: Field 0x{{[^ ]*}} 'f' 'int'
163163
};
164164

clang/test/AST/ast-dump-records.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ struct C {
9090
};
9191
// CHECK-NEXT: FieldDecl 0x{{[^ ]*}} <line:[[@LINE-14]]:3> col:3 implicit 'C::(anonymous union at {{.*}}:[[@LINE-14]]:3)'
9292
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <line:[[@LINE-6]]:9> col:9 implicit c 'int'
93-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 1 'C::(anonymous union at {{.*}}:[[@LINE-16]]:3)'
93+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'C::(anonymous union at {{.*}}:[[@LINE-16]]:3)'
9494
// CHECK-NEXT: Field 0x{{[^ ]*}} 'c' 'int'
9595
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <line:[[@LINE-7]]:11> col:11 implicit d 'float'
96-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 1 'C::(anonymous union at {{.*}}:[[@LINE-19]]:3)'
96+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'C::(anonymous union at {{.*}}:[[@LINE-19]]:3)'
9797
// CHECK-NEXT: Field 0x{{[^ ]*}} 'd' 'float'
9898

9999
struct {
@@ -111,10 +111,10 @@ struct C {
111111
};
112112
// CHECK-NEXT: FieldDecl 0x{{[^ ]*}} <line:[[@LINE-13]]:3> col:3 implicit 'C::(anonymous struct at {{.*}}:[[@LINE-13]]:3)'
113113
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <line:[[@LINE-5]]:9> col:9 implicit e 'int'
114-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 2 'C::(anonymous struct at {{.*}}:[[@LINE-15]]:3)'
114+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'C::(anonymous struct at {{.*}}:[[@LINE-15]]:3)'
115115
// CHECK-NEXT: Field 0x{{[^ ]*}} 'e' 'int'
116116
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <col:12> col:12 implicit f 'int'
117-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 2 'C::(anonymous struct at {{.*}}:[[@LINE-18]]:3)'
117+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'C::(anonymous struct at {{.*}}:[[@LINE-18]]:3)'
118118
// CHECK-NEXT: Field 0x{{[^ ]*}} 'f' 'int'
119119
};
120120

@@ -223,10 +223,10 @@ union G {
223223
};
224224
// CHECK-NEXT: FieldDecl 0x{{[^ ]*}} <line:[[@LINE-15]]:3> col:3 implicit 'G::(anonymous union at {{.*}}:[[@LINE-15]]:3)'
225225
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <line:[[@LINE-6]]:9> col:9 implicit c 'int'
226-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 1 'G::(anonymous union at {{.*}}:[[@LINE-17]]:3)'
226+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'G::(anonymous union at {{.*}}:[[@LINE-17]]:3)'
227227
// CHECK-NEXT: Field 0x{{[^ ]*}} 'c' 'int'
228228
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <line:[[@LINE-7]]:11> col:11 implicit d 'float'
229-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 1 'G::(anonymous union at {{.*}}:[[@LINE-20]]:3)'
229+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'G::(anonymous union at {{.*}}:[[@LINE-20]]:3)'
230230
// CHECK-NEXT: Field 0x{{[^ ]*}} 'd' 'float'
231231

232232
struct {
@@ -245,10 +245,10 @@ union G {
245245
};
246246
// CHECK-NEXT: FieldDecl 0x{{[^ ]*}} <line:[[@LINE-14]]:3> col:3 implicit 'G::(anonymous struct at {{.*}}:[[@LINE-14]]:3)'
247247
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <line:[[@LINE-5]]:9> col:9 implicit e 'int'
248-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 2 'G::(anonymous struct at {{.*}}:[[@LINE-16]]:3)'
248+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'G::(anonymous struct at {{.*}}:[[@LINE-16]]:3)'
249249
// CHECK-NEXT: Field 0x{{[^ ]*}} 'e' 'int'
250250
// CHECK-NEXT: IndirectFieldDecl 0x{{[^ ]*}} <col:12> col:12 implicit f 'int'
251-
// CHECK-NEXT: Field 0x{{[^ ]*}} field_index 2 'G::(anonymous struct at {{.*}}:[[@LINE-19]]:3)'
251+
// CHECK-NEXT: Field 0x{{[^ ]*}} '' 'G::(anonymous struct at {{.*}}:[[@LINE-19]]:3)'
252252
// CHECK-NEXT: Field 0x{{[^ ]*}} 'f' 'int'
253253
};
254254

clang/test/AST/attr-counted-by-late-parsed-struct-ptrs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct on_pointer_anon_count {
3131
// CHECK-NEXT: | `-FieldDecl {{.*}} count 'int'
3232
// CHECK-NEXT: |-FieldDecl {{.*}} implicit 'struct on_pointer_anon_count::(anonymous at {{.*}})'
3333
// CHECK-NEXT: `-IndirectFieldDecl {{.*}} implicit referenced count 'int'
34-
// CHECK-NEXT: |-Field {{.*}} field_index 1 'struct on_pointer_anon_count::(anonymous at {{.*}})'
34+
// CHECK-NEXT: |-Field {{.*}} '' 'struct on_pointer_anon_count::(anonymous at {{.*}})'
3535
// CHECK-NEXT: `-Field {{.*}} 'count' 'int'
3636

3737
//==============================================================================

clang/test/AST/attr-counted-by-or-null-late-parsed-struct-ptrs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct on_pointer_anon_count {
3131
// CHECK-NEXT: | `-FieldDecl {{.*}} count 'int'
3232
// CHECK-NEXT: |-FieldDecl {{.*}} implicit 'struct on_pointer_anon_count::(anonymous at {{.*}})'
3333
// CHECK-NEXT: `-IndirectFieldDecl {{.*}} implicit referenced count 'int'
34-
// CHECK-NEXT: |-Field {{.*}} field_index 1 'struct on_pointer_anon_count::(anonymous at {{.*}})'
34+
// CHECK-NEXT: |-Field {{.*}} '' 'struct on_pointer_anon_count::(anonymous at {{.*}})'
3535
// CHECK-NEXT: `-Field {{.*}} 'count' 'int'
3636

3737
//==============================================================================

clang/test/AST/attr-counted-by-or-null-struct-ptrs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct on_member_pointer_complete_ty {
2626
// CHECK-NEXT: | `-FieldDecl {{.+}} buf 'struct size_known * __counted_by_or_null(count)':'struct size_known *'
2727
// CHECK-NEXT: |-FieldDecl {{.+}} implicit 'struct on_pointer_anon_buf::(anonymous at [[ANON_STRUCT_PATH:.+]])'
2828
// CHECK-NEXT: `-IndirectFieldDecl {{.+}} implicit buf 'struct size_known * __counted_by_or_null(count)':'struct size_known *'
29-
// CHECK-NEXT: |-Field {{.+}} field_index 1 'struct on_pointer_anon_buf::(anonymous at [[ANON_STRUCT_PATH]])'
29+
// CHECK-NEXT: |-Field {{.+}} '' 'struct on_pointer_anon_buf::(anonymous at [[ANON_STRUCT_PATH]])'
3030
// CHECK-NEXT: `-Field {{.+}} 'buf' 'struct size_known * __counted_by_or_null(count)':'struct size_known *'
3131
struct on_pointer_anon_buf {
3232
int count;
@@ -94,7 +94,7 @@ struct on_nested_pointer_outer {
9494
// CHECK-NEXT: | `-FieldDecl {{.+}} buf 'struct size_known * __counted_by_or_null(count)':'struct size_known *'
9595
// CHECK-NEXT: |-FieldDecl {{.+}} implicit 'struct on_pointer_anon_buf_ty_pos::(anonymous at [[ANON_STRUCT_PATH2:.+]])'
9696
// CHECK-NEXT: `-IndirectFieldDecl {{.+}} implicit buf 'struct size_known * __counted_by_or_null(count)':'struct size_known *'
97-
// CHECK-NEXT: |-Field {{.+}} field_index 1 'struct on_pointer_anon_buf_ty_pos::(anonymous at [[ANON_STRUCT_PATH2]])'
97+
// CHECK-NEXT: |-Field {{.+}} '' 'struct on_pointer_anon_buf_ty_pos::(anonymous at [[ANON_STRUCT_PATH2]])'
9898
// CHECK-NEXT: `-Field {{.+}} 'buf' 'struct size_known * __counted_by_or_null(count)':'struct size_known *'
9999
struct on_pointer_anon_buf_ty_pos {
100100
int count;
@@ -108,7 +108,7 @@ struct on_pointer_anon_buf_ty_pos {
108108
// CHECK-NEXT: | `-FieldDecl {{.+}} count 'int'
109109
// CHECK-NEXT: |-FieldDecl {{.+}} implicit 'struct on_pointer_anon_count_ty_pos::(anonymous at [[ANON_STRUCT_PATH3:.+]])'
110110
// CHECK-NEXT: |-IndirectFieldDecl {{.+}} implicit referenced count 'int'
111-
// CHECK-NEXT: | |-Field {{.+}} field_index 0 'struct on_pointer_anon_count_ty_pos::(anonymous at [[ANON_STRUCT_PATH3]])'
111+
// CHECK-NEXT: | |-Field {{.+}} '' 'struct on_pointer_anon_count_ty_pos::(anonymous at [[ANON_STRUCT_PATH3]])'
112112
// CHECK-NEXT: | `-Field {{.+}} 'count' 'int'
113113
struct on_pointer_anon_count_ty_pos {
114114
struct {

clang/test/AST/attr-counted-by-struct-ptrs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct on_member_pointer_complete_ty {
2626
// CHECK-NEXT: | `-FieldDecl {{.+}} buf 'struct size_known * __counted_by(count)':'struct size_known *'
2727
// CHECK-NEXT: |-FieldDecl {{.+}} implicit 'struct on_pointer_anon_buf::(anonymous at [[ANON_STRUCT_PATH:.+]])'
2828
// CHECK-NEXT: `-IndirectFieldDecl {{.+}} implicit buf 'struct size_known * __counted_by(count)':'struct size_known *'
29-
// CHECK-NEXT: |-Field {{.+}} field_index 1 'struct on_pointer_anon_buf::(anonymous at [[ANON_STRUCT_PATH]])'
29+
// CHECK-NEXT: |-Field {{.+}} '' 'struct on_pointer_anon_buf::(anonymous at [[ANON_STRUCT_PATH]])'
3030
// CHECK-NEXT: `-Field {{.+}} 'buf' 'struct size_known * __counted_by(count)':'struct size_known *'
3131
struct on_pointer_anon_buf {
3232
int count;
@@ -94,7 +94,7 @@ struct on_nested_pointer_outer {
9494
// CHECK-NEXT: | `-FieldDecl {{.+}} buf 'struct size_known * __counted_by(count)':'struct size_known *'
9595
// CHECK-NEXT: |-FieldDecl {{.+}} implicit 'struct on_pointer_anon_buf_ty_pos::(anonymous at [[ANON_STRUCT_PATH2:.+]])'
9696
// CHECK-NEXT: `-IndirectFieldDecl {{.+}} implicit buf 'struct size_known * __counted_by(count)':'struct size_known *'
97-
// CHECK-NEXT: |-Field {{.+}} field_index 1 'struct on_pointer_anon_buf_ty_pos::(anonymous at [[ANON_STRUCT_PATH2]])'
97+
// CHECK-NEXT: |-Field {{.+}} '' 'struct on_pointer_anon_buf_ty_pos::(anonymous at [[ANON_STRUCT_PATH2]])'
9898
// CHECK-NEXT: `-Field {{.+}} 'buf' 'struct size_known * __counted_by(count)':'struct size_known *'
9999
struct on_pointer_anon_buf_ty_pos {
100100
int count;
@@ -108,7 +108,7 @@ struct on_pointer_anon_buf_ty_pos {
108108
// CHECK-NEXT: | `-FieldDecl {{.+}} count 'int'
109109
// CHECK-NEXT: |-FieldDecl {{.+}} implicit 'struct on_pointer_anon_count_ty_pos::(anonymous at [[ANON_STRUCT_PATH3:.+]])'
110110
// CHECK-NEXT: |-IndirectFieldDecl {{.+}} implicit referenced count 'int'
111-
// CHECK-NEXT: | |-Field {{.+}} field_index 0 'struct on_pointer_anon_count_ty_pos::(anonymous at [[ANON_STRUCT_PATH3]])'
111+
// CHECK-NEXT: | |-Field {{.+}} '' 'struct on_pointer_anon_count_ty_pos::(anonymous at [[ANON_STRUCT_PATH3]])'
112112
// CHECK-NEXT: | `-Field {{.+}} 'count' 'int'
113113
struct on_pointer_anon_count_ty_pos {
114114
struct {

clang/test/AST/attr-sized-by-late-parsed-struct-ptrs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct on_pointer_anon_count {
3131
// CHECK-NEXT: | `-FieldDecl {{.*}} count 'int'
3232
// CHECK-NEXT: |-FieldDecl {{.*}} implicit 'struct on_pointer_anon_count::(anonymous at {{.*}})'
3333
// CHECK-NEXT: `-IndirectFieldDecl {{.*}} implicit referenced count 'int'
34-
// CHECK-NEXT: |-Field {{.*}} field_index 1 'struct on_pointer_anon_count::(anonymous at {{.*}})'
34+
// CHECK-NEXT: |-Field {{.*}} '' 'struct on_pointer_anon_count::(anonymous at {{.*}})'
3535
// CHECK-NEXT: `-Field {{.*}} 'count' 'int'
3636

3737
//==============================================================================

clang/test/AST/attr-sized-by-or-null-late-parsed-struct-ptrs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct on_pointer_anon_count {
3131
// CHECK-NEXT: | `-FieldDecl {{.*}} count 'int'
3232
// CHECK-NEXT: |-FieldDecl {{.*}} implicit 'struct on_pointer_anon_count::(anonymous at {{.*}})'
3333
// CHECK-NEXT: `-IndirectFieldDecl {{.*}} implicit referenced count 'int'
34-
// CHECK-NEXT: |-Field {{.*}} field_index 1 'struct on_pointer_anon_count::(anonymous at {{.*}})'
34+
// CHECK-NEXT: |-Field {{.*}} '' 'struct on_pointer_anon_count::(anonymous at {{.*}})'
3535
// CHECK-NEXT: `-Field {{.*}} 'count' 'int'
3636

3737
//==============================================================================

0 commit comments

Comments
 (0)