diff options
author | Anders Carlsson <andersca@mac.com> | 2010-04-24 19:06:50 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-04-24 19:06:50 +0000 |
commit | a70cff624ef05cc5692b36077468ca785abd6db1 (patch) | |
tree | 93418527cd7d3fcb4a13bd2ad3f97adeb855f6d1 /clang/lib/AST/StmtDumper.cpp | |
parent | 5d270e8fa6fbd7ba9be6a3fa765f6a8ed1e2ac9b (diff) | |
download | bcm5719-llvm-a70cff624ef05cc5692b36077468ca785abd6db1.tar.gz bcm5719-llvm-a70cff624ef05cc5692b36077468ca785abd6db1.zip |
Actually produce base paths for CastExprs of kind CK_DerivedToBase.
llvm-svn: 102259
Diffstat (limited to 'clang/lib/AST/StmtDumper.cpp')
-rw-r--r-- | clang/lib/AST/StmtDumper.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/clang/lib/AST/StmtDumper.cpp b/clang/lib/AST/StmtDumper.cpp index 8481055b9d0..f8b81735193 100644 --- a/clang/lib/AST/StmtDumper.cpp +++ b/clang/lib/AST/StmtDumper.cpp @@ -300,9 +300,35 @@ void StmtDumper::VisitExpr(Expr *Node) { DumpExpr(Node); } +static void DumpBasePath(llvm::raw_ostream &OS, CastExpr *Node) { + if (Node->getBasePath().empty()) + return; + + OS << " ("; + bool First = true; + for (CXXBaseSpecifierArray::iterator I = Node->getBasePath().begin(), + E = Node->getBasePath().end(); I != E; ++I) { + const CXXBaseSpecifier *Base = *I; + if (!First) + OS << " -> "; + + const CXXRecordDecl *RD = + cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl()); + + if (Base->isVirtual()) + OS << "virtual "; + OS << RD->getName(); + First = false; + } + + OS << ')'; +} + void StmtDumper::VisitCastExpr(CastExpr *Node) { DumpExpr(Node); - OS << " <" << Node->getCastKindName() << ">"; + OS << " <" << Node->getCastKindName(); + DumpBasePath(OS, Node); + OS << ">"; } void StmtDumper::VisitImplicitCastExpr(ImplicitCastExpr *Node) { @@ -452,7 +478,9 @@ void StmtDumper::VisitCXXNamedCastExpr(CXXNamedCastExpr *Node) { DumpExpr(Node); OS << " " << Node->getCastName() << "<" << Node->getTypeAsWritten().getAsString() << ">" - << " <" << Node->getCastKindName() << ">"; + << " <" << Node->getCastKindName(); + DumpBasePath(OS, Node); + OS << ">"; } void StmtDumper::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *Node) { |