aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/StmtPrinter.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2008-12-22 21:35:02 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2008-12-22 21:35:02 +0000
commit8351da06ca3082dfd49dd8e3c1785a986920f57c (patch)
tree4000bf4f6263ae88d9580228d58d1631534a61ee /lib/AST/StmtPrinter.cpp
parent27b09ac9f7a4b2555bb9adda3568f3ba6264a63e (diff)
Full AST support and better Sema support for C++ try-catch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61346 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/StmtPrinter.cpp')
-rw-r--r--lib/AST/StmtPrinter.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index 61cd89f70f..521478953f 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -52,6 +52,7 @@ namespace {
void PrintRawDecl(Decl *D);
void PrintRawDeclStmt(DeclStmt *S);
void PrintRawIfStmt(IfStmt *If);
+ void PrintRawCXXCatchStmt(CXXCatchStmt *Catch);
void PrintExpr(Expr *E) {
if (E)
@@ -474,14 +475,29 @@ void StmtPrinter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *Node) {
OS << "\n";
}
-void StmtPrinter::VisitCXXCatchStmt(CXXCatchStmt *Node) {
- Indent() << "catch (";
+void StmtPrinter::PrintRawCXXCatchStmt(CXXCatchStmt *Node) {
+ OS << "catch (";
if (Decl *ExDecl = Node->getExceptionDecl())
PrintRawDecl(ExDecl);
else
OS << "...";
OS << ") ";
PrintRawCompoundStmt(cast<CompoundStmt>(Node->getHandlerBlock()));
+}
+
+void StmtPrinter::VisitCXXCatchStmt(CXXCatchStmt *Node) {
+ Indent();
+ PrintRawCXXCatchStmt(Node);
+ OS << "\n";
+}
+
+void StmtPrinter::VisitCXXTryStmt(CXXTryStmt *Node) {
+ Indent() << "try ";
+ PrintRawCompoundStmt(Node->getTryBlock());
+ for(unsigned i = 0, e = Node->getNumHandlers(); i < e; ++i) {
+ OS << " ";
+ PrintRawCXXCatchStmt(Node->getHandler(i));
+ }
OS << "\n";
}