From 0738468322f26b547ed43dae429e427201c5f85f Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Wed, 12 Aug 2009 00:21:52 +0000 Subject: [PATCH] Add some information about temporaries to the statement dumper. llvm-svn: 78754 --- clang/lib/AST/StmtDumper.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/clang/lib/AST/StmtDumper.cpp b/clang/lib/AST/StmtDumper.cpp index bc096bf0d9f3..1087b0d6f272 100644 --- a/clang/lib/AST/StmtDumper.cpp +++ b/clang/lib/AST/StmtDumper.cpp @@ -137,6 +137,10 @@ namespace { void VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *Node); void VisitCXXThisExpr(CXXThisExpr *Node); void VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *Node); + void VisitCXXConstructExpr(CXXConstructExpr *Node); + void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *Node); + void VisitCXXExprWithTemporaries(CXXExprWithTemporaries *Node); + void DumpCXXTemporary(CXXTemporary *Temporary); // ObjC void VisitObjCEncodeExpr(ObjCEncodeExpr *Node); @@ -451,6 +455,33 @@ void StmtDumper::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *Node) { Node->getTypeAsWritten().getAsString().c_str()); } +void StmtDumper::VisitCXXConstructExpr(CXXConstructExpr *Node) { + DumpExpr(Node); + if (Node->isElidable()) + fprintf(F, "elidable"); +} + +void StmtDumper::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *Node) { + DumpExpr(Node); + fprintf(F, " "); + DumpCXXTemporary(Node->getTemporary()); +} + +void StmtDumper::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *Node) { + DumpExpr(Node); + ++IndentLevel; + for (unsigned i = 0, e = Node->getNumTemporaries(); i != e; ++i) { + fprintf(F, "\n"); + Indent(); + DumpCXXTemporary(Node->getTemporary(i)); + } + --IndentLevel; +} + +void StmtDumper::DumpCXXTemporary(CXXTemporary *Temporary) { + fprintf(F, "(CXXTemporary %p)", (void *)Temporary); +} + //===----------------------------------------------------------------------===// // Obj-C Expressions //===----------------------------------------------------------------------===//