diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp index b90f32389c897..c8b459ee78e6b 100644 --- a/clang/lib/AST/TextNodeDumper.cpp +++ b/clang/lib/AST/TextNodeDumper.cpp @@ -738,6 +738,14 @@ void TextNodeDumper::Visit(const APValue &Value, QualType Ty) { else if (const auto *BE = B.dyn_cast()) { OS << BE->getStmtClassName() << ' '; dumpPointer(BE); + } else if (const auto BTI = B.dyn_cast()) { + OS << "TypeInfoLValue "; + ColorScope Color(OS, ShowColors, TypeColor); + BTI.print(OS, PrintPolicy); + } else if (B.is()) { + OS << "DynamicAllocLValue"; + auto BDA = B.getDynamicAllocType(); + dumpType(BDA); } else { const auto *VDB = B.get(); OS << VDB->getDeclKindName() << "Decl"; diff --git a/clang/test/AST/ast-dump-APValue-lvalue.cpp b/clang/test/AST/ast-dump-APValue-lvalue.cpp index 224caddb3eabe..333f7aa419377 100644 --- a/clang/test/AST/ast-dump-APValue-lvalue.cpp +++ b/clang/test/AST/ast-dump-APValue-lvalue.cpp @@ -23,6 +23,10 @@ struct F { }; F f; +namespace std { + class type_info; +} + void Test(int (&arr)[10]) { constexpr int *pi = &i; // CHECK: | `-VarDecl {{.*}} col:{{.*}} pi 'int *const' constexpr cinit @@ -45,6 +49,10 @@ void Test(int (&arr)[10]) { // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=2, HasPath=1, PathLength=2, Path=({{.*}}, 2) constexpr const int *n = nullptr; - // CHECK: `-VarDecl {{.*}} col:{{.*}} n 'const int *const' constexpr cinit - // CHECK-NEXT: |-value: LValue Base=null, Null=1, Offset=0, HasPath=1, PathLength=0, Path=() + // CHECK: | `-VarDecl {{.*}} col:{{.*}} n 'const int *const' constexpr cinit + // 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:{{.*}} pti 'const std::type_info *const' constexpr cinit + // CHECK-NEXT: |-value: LValue Base=TypeInfoLValue typeid(int), Null=0, Offset=0, HasPath=1, PathLength=0, Path=() }