Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/include/clang/AST/TextNodeDumper.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ class TextNodeDumper
void dumpType(QualType T);
void dumpBareDeclRef(const Decl *D);
void dumpName(const NamedDecl *ND);
void dumpFormalLinkage(const NamedDecl *ND);
void dumpAccessSpecifier(AccessSpecifier AS);
void dumpCleanupObject(const ExprWithCleanups::CleanupObject &C);
void dumpTemplateSpecializationKind(TemplateSpecializationKind TSK);
Expand Down
65 changes: 65 additions & 0 deletions clang/lib/AST/TextNodeDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1429,6 +1429,29 @@ static void dumpBasePath(raw_ostream &OS, const CastExpr *Node) {
OS << ')';
}

void TextNodeDumper::dumpFormalLinkage(const NamedDecl *ND) {
switch (ND->getFormalLinkage()) {
case Linkage::None:
OS << " no-linkage";
break;
case Linkage::Internal:
OS << " internal-linkage";
break;
case Linkage::External:
OS << " external-linkage";
break;
case Linkage::Module:
OS << " module-linkage";
break;
case Linkage::Invalid:
OS << " invalid-linkage";
break;
Comment thread
Endilll marked this conversation as resolved.
Outdated
case Linkage::UniqueExternal:
case Linkage::VisibleNone:
llvm_unreachable("Not a formal linkage!");
}
}

void TextNodeDumper::VisitLoopControlStmt(const LoopControlStmt *Node) {
if (!Node->hasLabelTarget())
return;
Expand Down Expand Up @@ -2295,6 +2318,11 @@ void TextNodeDumper::VisitTypedefDecl(const TypedefDecl *D) {
dumpType(D->getUnderlyingType());
if (D->isModulePrivate())
OS << " __module_private__";

const TagDecl *TD = D->getUnderlyingType()->getAsTagDecl();
if (TD && TD->getTypedefNameForAnonDecl()) {
Comment thread
Endilll marked this conversation as resolved.
dumpFormalLinkage(D);
}
}

void TextNodeDumper::VisitEnumDecl(const EnumDecl *D) {
Expand All @@ -2314,6 +2342,11 @@ void TextNodeDumper::VisitEnumDecl(const EnumDecl *D) {
OS << " instantiated_from";
dumpPointer(Instance);
}

if (D->getDeclName() ||
(!D->enumerators().empty() && !D->getTypedefNameForAnonDecl())) {
dumpFormalLinkage(D);
}
}

void TextNodeDumper::VisitRecordDecl(const RecordDecl *D) {
Expand All @@ -2323,6 +2356,13 @@ void TextNodeDumper::VisitRecordDecl(const RecordDecl *D) {
OS << " __module_private__";
if (D->isCompleteDefinition())
OS << " definition";

if (D->getDeclName() && !D->isImplicit() &&
D->getFriendObjectKind() == Decl::FOK_None &&
(!D->getDescribedTemplate() ||
D->getDescribedTemplate()->getFriendObjectKind() == Decl::FOK_None)) {
dumpFormalLinkage(D);
}
}

void TextNodeDumper::VisitEnumConstantDecl(const EnumConstantDecl *D) {
Expand Down Expand Up @@ -2420,6 +2460,11 @@ void TextNodeDumper::VisitFunctionDecl(const FunctionDecl *D) {
OS << " instantiated_from";
dumpPointer(Instance);
}

if (D->getFriendObjectKind() == Decl::FOK_None &&
!isa<CXXDeductionGuideDecl>(D)) {
dumpFormalLinkage(D);
}
}

void TextNodeDumper::VisitCXXDeductionGuideDecl(
Expand Down Expand Up @@ -2520,6 +2565,10 @@ void TextNodeDumper::VisitVarDecl(const VarDecl *D) {
AddChild("value", [=] { Visit(*Value, E->getType()); });
}
}

if (!isa<ParmVarDecl, ImplicitParamDecl, OMPCapturedExprDecl>(D)) {
dumpFormalLinkage(D);
}
}

void TextNodeDumper::VisitBindingDecl(const BindingDecl *D) {
Expand Down Expand Up @@ -2633,6 +2682,8 @@ void TextNodeDumper::VisitNamespaceDecl(const NamespaceDecl *D) {
OS << " nested";
if (!D->isFirstDecl())
dumpDeclRef(D->getFirstDecl(), "original");

dumpFormalLinkage(D);
}

void TextNodeDumper::VisitUsingDirectiveDecl(const UsingDirectiveDecl *D) {
Expand All @@ -2648,11 +2699,17 @@ void TextNodeDumper::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) {
void TextNodeDumper::VisitTypeAliasDecl(const TypeAliasDecl *D) {
dumpName(D);
dumpType(D->getUnderlyingType());

const TagDecl *TD = D->getUnderlyingType()->getAsTagDecl();
if (TD && TD->getTypedefNameForAnonDecl()) {
dumpFormalLinkage(D);
}
}

void TextNodeDumper::VisitTypeAliasTemplateDecl(
const TypeAliasTemplateDecl *D) {
dumpName(D);
dumpFormalLinkage(D);
}

void TextNodeDumper::VisitCXXRecordDecl(const CXXRecordDecl *D) {
Expand Down Expand Up @@ -2813,14 +2870,21 @@ void TextNodeDumper::VisitCXXRecordDecl(const CXXRecordDecl *D) {

void TextNodeDumper::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) {
dumpName(D);
if (D->getFriendObjectKind() == Decl::FOK_None) {
dumpFormalLinkage(D);
}
}

void TextNodeDumper::VisitClassTemplateDecl(const ClassTemplateDecl *D) {
dumpName(D);
if (D->getFriendObjectKind() == Decl::FOK_None) {
dumpFormalLinkage(D);
}
}

void TextNodeDumper::VisitVarTemplateDecl(const VarTemplateDecl *D) {
dumpName(D);
dumpFormalLinkage(D);
}

void TextNodeDumper::VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D) {
Expand Down Expand Up @@ -3105,6 +3169,7 @@ void TextNodeDumper::VisitBlockDecl(const BlockDecl *D) {

void TextNodeDumper::VisitConceptDecl(const ConceptDecl *D) {
dumpName(D);
dumpFormalLinkage(D);
}

void TextNodeDumper::VisitCompoundStmt(const CompoundStmt *S) {
Expand Down
10 changes: 5 additions & 5 deletions clang/test/AST/ast-dump-APValue-anon-union.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ union U1 {

void Test() {
constexpr S0 s0{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s0 'const S0' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s0 'const S0' constexpr listinit no-linkage
// CHECK-NEXT: | |-value: Struct
// CHECK-NEXT: | | `-field: Union .i Int 42

constexpr U0 u0a{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0a 'const U0' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0a 'const U0' constexpr listinit no-linkage
// CHECK-NEXT: | |-value: Union .U0::(anonymous union at {{.*}}) Union .f Float 3.141500e+00

constexpr U0 u0b{3.1415f};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0b 'const U0' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0b 'const U0' constexpr listinit no-linkage
// CHECK-NEXT: | |-value: Union .U0::(anonymous union at {{.*}}) Union .f Float 3.141500e+00

constexpr U1 u1a{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1a 'const U1' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1a 'const U1' constexpr listinit no-linkage
// CHECK-NEXT: | |-value: Union .U1::(anonymous union at {{.*}}) Union .f Float 0.000000e+00

constexpr U1 u1b{3.1415f};
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1b 'const U1' constexpr listinit
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1b 'const U1' constexpr listinit no-linkage
// CHECK-NEXT: |-value: Union .U1::(anonymous union at {{.*}}) Union .f Float 3.141500e+00
}
16 changes: 8 additions & 8 deletions clang/test/AST/ast-dump-APValue-arithmetic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@

void Test() {
constexpr int Int = 42;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} Int 'const int' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} Int 'const int' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: Int 42

constexpr __int128 Int128 = (__int128)0xFFFFFFFFFFFFFFFF + (__int128)1;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} Int128 'const __int128' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} Int128 'const __int128' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: Int 18446744073709551616

constexpr float Float = 3.1415f;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} Float 'const float' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} Float 'const float' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: Float 3.141500e+00

constexpr double Double = 3.1415f;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} Double 'const double' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} Double 'const double' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: Float 3.141500e+00

constexpr _Complex int ComplexInt = 42 + 24i;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} referenced ComplexInt 'const _Complex int' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} referenced ComplexInt 'const _Complex int' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: ComplexInt 42 + 24i

constexpr _Complex float ComplexFloat = 3.1415f + 42i;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} referenced ComplexFloat 'const _Complex float' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} referenced ComplexFloat 'const _Complex float' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: ComplexFloat 3.141500e+00 + 4.200000e+01i

constexpr _Complex int ArrayOfComplexInt[10] = {ComplexInt, ComplexInt, ComplexInt, ComplexInt};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} ArrayOfComplexInt 'const _Complex int[10]' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} ArrayOfComplexInt 'const _Complex int[10]' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: Array size=10
// CHECK-NEXT: | | |-elements: ComplexInt 42 + 24i, ComplexInt 42 + 24i, ComplexInt 42 + 24i, ComplexInt 42 + 24i
// CHECK-NEXT: | | `-filler: 6 x ComplexInt 0 + 0i

constexpr _Complex float ArrayOfComplexFloat[10] = {ComplexFloat, ComplexFloat, ComplexInt, ComplexInt};
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} ArrayOfComplexFloat 'const _Complex float[10]' constexpr cinit
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} ArrayOfComplexFloat 'const _Complex float[10]' constexpr cinit no-linkage
// CHECK-NEXT: |-value: Array size=10
// CHECK-NEXT: | |-elements: ComplexFloat 3.141500e+00 + 4.200000e+01i, ComplexFloat 3.141500e+00 + 4.200000e+01i, ComplexFloat 4.200000e+01 + 2.400000e+01i, ComplexFloat 4.200000e+01 + 2.400000e+01i
// CHECK-NEXT: | `-filler: 6 x ComplexFloat 0.000000e+00 + 0.000000e+00i
Expand Down
10 changes: 5 additions & 5 deletions clang/test/AST/ast-dump-APValue-array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void Test() {
{1, 2, 3, 4, 5},
{1, 2, 3, 4},
};
// CHECK: | `-VarDecl {{.*}} <line:{{.*}}, line:{{.*}}> line:{{.*}} arr_v5i '__attribute__((__vector_size__(5 * sizeof(int)))) int const[5]' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <line:{{.*}}, line:{{.*}}> line:{{.*}} arr_v5i '__attribute__((__vector_size__(5 * sizeof(int)))) int const[5]' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: Array size=5
// CHECK-NEXT: | | |-element: Vector length=5
// CHECK-NEXT: | | | |-elements: Int 1, Int 2, Int 3, Int 4
Expand All @@ -43,7 +43,7 @@ void Test() {
constexpr float arr_f[3][5] = {
{1, 2, 3, 4, 5},
};
// CHECK: | `-VarDecl {{.*}} <line:{{.*}}, line:{{.*}}> line:{{.*}} arr_f 'const float[3][5]' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <line:{{.*}}, line:{{.*}}> line:{{.*}} arr_f 'const float[3][5]' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: Array size=3
// CHECK-NEXT: | | |-element: Array size=5
// CHECK-NEXT: | | | |-elements: Float 1.000000e+00, Float 2.000000e+00, Float 3.000000e+00, Float 4.000000e+00
Expand All @@ -52,7 +52,7 @@ void Test() {
// CHECK-NEXT: | | `-filler: 5 x Float 0.000000e+00

constexpr S0 arr_s0[2] = {{1, 2}, {3, 4}};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} arr_s0 'const S0[2]' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} arr_s0 'const S0[2]' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: Array size=2
// CHECK-NEXT: | | |-element: Struct
// CHECK-NEXT: | | | `-field: Array size=2
Expand All @@ -62,12 +62,12 @@ void Test() {
// CHECK-NEXT: | | `-elements: Int 3, Int 4

constexpr U0 arr_u0[2] = {{.i = 42}, {.f = 3.1415f}};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} arr_u0 'const U0[2]' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} arr_u0 'const U0[2]' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: Array size=2
// CHECK-NEXT: | | `-elements: Union .i Int 42, Union .f Float 3.141500e+00

constexpr S1 arr_s1[2] = {};
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} arr_s1 'const S1[2]' constexpr cinit
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} arr_s1 'const S1[2]' constexpr cinit no-linkage
// CHECK-NEXT: |-value: Array size=2
// CHECK-NEXT: | |-element: Struct
// CHECK-NEXT: | | |-field: Struct
Expand Down
18 changes: 9 additions & 9 deletions clang/test/AST/ast-dump-APValue-lvalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,38 +39,38 @@ struct MP : P, Q {

void Test(int (&arr)[10]) {
constexpr int *pi = &i;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pi 'int *const' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pi 'int *const' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=0, HasPath=1, PathLength=0, Path=()

constexpr int *psi = &s.i;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} psi 'int *const' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} psi 'int *const' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=0, HasPath=1, PathLength=1, Path=({{.*}})

constexpr int *psii = &s.ii;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} psii 'int *const' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} psii 'int *const' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=4, HasPath=1, PathLength=1, Path=({{.*}})

constexpr int *pf = &f.s.ii;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pf 'int *const' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pf 'int *const' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=16, HasPath=1, PathLength=2, Path=({{.*}}, {{.*}})

constexpr char *pc = &f.padding[2];
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pc 'char *const' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pc 'char *const' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=2, HasPath=1, PathLength=2, Path=({{.*}}, 2)

constexpr const int *n = nullptr;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} n 'const int *const' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} n 'const int *const' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: LValue Base=null, Null=1, Offset=0, HasPath=1, PathLength=0, Path=()

constexpr const std::type_info* pti = &typeid(int);
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pti 'const std::type_info *const' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pti 'const std::type_info *const' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: LValue Base=TypeInfoLValue typeid(int), Null=0, Offset=0, HasPath=1, PathLength=0, Path=()

constexpr int(MP::*pmi) = (int MP::*)&P::x;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pmi 'int (MP::*const)' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pmi 'int (MP::*const)' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: MemberPointer MP::x

constexpr int(MP::*pmn) = (int MP::*)nullptr;
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pmn 'int (MP::*const)' constexpr cinit
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pmn 'int (MP::*const)' constexpr cinit no-linkage
// CHECK-NEXT: |-value: MemberPointer null
}
12 changes: 6 additions & 6 deletions clang/test/AST/ast-dump-APValue-struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,25 @@ struct S5 : S4 {

void Test() {
constexpr S0 s0{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s0 'const S0' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s0 'const S0' constexpr listinit no-linkage
// CHECK-NEXT: | |-value: Struct
// CHECK-NEXT: | | `-fields: Int 0, Union .j Int 0

constexpr S1 s1{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s1 'const S1' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s1 'const S1' constexpr listinit no-linkage
// CHECK-NEXT: | |-value: Struct
// CHECK-NEXT: | | |-field: Int 0
// CHECK-NEXT: | | `-field: Union .s
// CHECK-NEXT: | | `-Struct
// CHECK-NEXT: | | `-field: Int 0

constexpr S2 s2{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s2 'const S2' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s2 'const S2' constexpr listinit no-linkage
// CHECK-NEXT: | |-value: Struct
// CHECK-NEXT: | | `-fields: Int 0, Union .u Union .j Int 0

constexpr S3 s3{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s3 'const S3' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s3 'const S3' constexpr listinit no-linkage
// CHECK-NEXT: | |-value: Struct
// CHECK-NEXT: | | |-field: Int 0
// CHECK-NEXT: | | `-field: Union .u
Expand All @@ -87,7 +87,7 @@ void Test() {
// CHECK-NEXT: | | `-field: Int 0

constexpr S4 s4{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s4 'const S4' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s4 'const S4' constexpr listinit no-linkage
// CHECK-NEXT: | |-value: Struct
// CHECK-NEXT: | | |-base: Struct
// CHECK-NEXT: | | | `-fields: Int 0, Union .j Int 0
Expand All @@ -96,7 +96,7 @@ void Test() {
// CHECK-NEXT: | | `-fields: Int 4, Int 5, Int 6

constexpr S5 s5{};
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s5 'const S5' constexpr listinit
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s5 'const S5' constexpr listinit no-linkage
// CHECK-NEXT: |-value: Struct
// CHECK-NEXT: | |-base: Struct
// CHECK-NEXT: | | |-base: Struct
Expand Down
10 changes: 5 additions & 5 deletions clang/test/AST/ast-dump-APValue-union.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,25 @@ union U3 {

void Test() {
constexpr U0 u0{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0 'const U0' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0 'const U0' constexpr listinit no-linkage
// CHECK-NEXT: | |-value: Union .i Int 42

constexpr U1 u1{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1 'const U1' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1 'const U1' constexpr listinit no-linkage
// CHECK-NEXT: | |-value: Union .uinner Union .f Float 3.141500e+00

constexpr U2 u2{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u2 'const U2' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u2 'const U2' constexpr listinit no-linkage
// CHECK-NEXT: | |-value: Union .uinner
// CHECK-NEXT: | | `-Union .arr
// CHECK-NEXT: | | `-Array size=2
// CHECK-NEXT: | | `-elements: Int 1, Int 2

constexpr U3 u3a = {.f = 3.1415};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u3a 'const U3' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u3a 'const U3' constexpr cinit no-linkage
// CHECK-NEXT: | |-value: Union .f Float 3.141500e+00

constexpr U3 u3b = {.uinner = {}};
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u3b 'const U3' constexpr cinit
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u3b 'const U3' constexpr cinit no-linkage
// CHECK-NEXT: |-value: Union .uinner Union .d Float 3.141500e+00
}
Loading