Index: include/clang/AST/TextNodeDumper.h =================================================================== --- include/clang/AST/TextNodeDumper.h +++ include/clang/AST/TextNodeDumper.h @@ -159,6 +159,8 @@ void Visit(const Stmt *Node); + void Visit(const Type *T); + void dumpPointer(const void *Ptr); void dumpLocation(SourceLocation Loc); void dumpSourceRange(SourceRange R); Index: lib/AST/ASTDumper.cpp =================================================================== --- lib/AST/ASTDumper.cpp +++ lib/AST/ASTDumper.cpp @@ -430,47 +430,18 @@ void ASTDumper::dumpTypeAsChild(const Type *T) { dumpChild([=] { - if (!T) { - ColorScope Color(OS, ShowColors, NullColor); - OS << "<<>>"; + NodeDumper.Visit(T); + if (!T) return; - } if (const LocInfoType *LIT = llvm::dyn_cast(T)) { - { - ColorScope Color(OS, ShowColors, TypeColor); - OS << "LocInfo Type"; - } - NodeDumper.dumpPointer(T); dumpTypeAsChild(LIT->getTypeSourceInfo()->getType()); return; } - - { - ColorScope Color(OS, ShowColors, TypeColor); - OS << T->getTypeClassName() << "Type"; - } - NodeDumper.dumpPointer(T); - OS << " "; - NodeDumper.dumpBareType(QualType(T, 0), false); + TypeVisitor::Visit(T); QualType SingleStepDesugar = T->getLocallyUnqualifiedSingleStepDesugaredType(); if (SingleStepDesugar != QualType(T, 0)) - OS << " sugar"; - if (T->isDependentType()) - OS << " dependent"; - else if (T->isInstantiationDependentType()) - OS << " instantiation_dependent"; - if (T->isVariablyModifiedType()) - OS << " variably_modified"; - if (T->containsUnexpandedParameterPack()) - OS << " contains_unexpanded_pack"; - if (T->isFromAST()) - OS << " imported"; - - TypeVisitor::Visit(T); - - if (SingleStepDesugar != QualType(T, 0)) dumpTypeAsChild(SingleStepDesugar); }); } Index: lib/AST/TextNodeDumper.cpp =================================================================== --- lib/AST/TextNodeDumper.cpp +++ lib/AST/TextNodeDumper.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "clang/AST/TextNodeDumper.h" +#include "clang/AST/LocInfoType.h" using namespace clang; @@ -130,6 +131,47 @@ ConstStmtVisitor::Visit(Node); } +void TextNodeDumper::Visit(const Type *T) { + if (!T) { + ColorScope Color(OS, ShowColors, NullColor); + OS << "<<>>"; + return; + } + if (isa(T)) { + { + ColorScope Color(OS, ShowColors, TypeColor); + OS << "LocInfo Type"; + } + dumpPointer(T); + return; + } + + { + ColorScope Color(OS, ShowColors, TypeColor); + OS << T->getTypeClassName() << "Type"; + } + dumpPointer(T); + OS << " "; + dumpBareType(QualType(T, 0), false); + + QualType SingleStepDesugar = + T->getLocallyUnqualifiedSingleStepDesugaredType(); + if (SingleStepDesugar != QualType(T, 0)) + OS << " sugar"; + + if (T->isDependentType()) + OS << " dependent"; + else if (T->isInstantiationDependentType()) + OS << " instantiation_dependent"; + + if (T->isVariablyModifiedType()) + OS << " variably_modified"; + if (T->containsUnexpandedParameterPack()) + OS << " contains_unexpanded_pack"; + if (T->isFromAST()) + OS << " imported"; +} + void TextNodeDumper::dumpPointer(const void *Ptr) { ColorScope Color(OS, ShowColors, AddressColor); OS << ' ' << Ptr;