r189941 - ASTDumper: fix dump of CXXCatchStmt

Pavel Labath labath at google.com
Wed Sep 4 07:35:01 PDT 2013


Author: labath
Date: Wed Sep  4 09:35:00 2013
New Revision: 189941

URL: http://llvm.org/viewvc/llvm-project?rev=189941&view=rev
Log:
ASTDumper: fix dump of CXXCatchStmt

Summary: I added the display of the VarDecl contained in the statement.

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1596

Modified:
    cfe/trunk/lib/AST/ASTDumper.cpp
    cfe/trunk/test/Misc/ast-dump-stmt.cpp

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=189941&r1=189940&r2=189941&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Wed Sep  4 09:35:00 2013
@@ -249,6 +249,7 @@ namespace  {
     void VisitAttributedStmt(const AttributedStmt *Node);
     void VisitLabelStmt(const LabelStmt *Node);
     void VisitGotoStmt(const GotoStmt *Node);
+    void VisitCXXCatchStmt(const CXXCatchStmt *Node);
 
     // Exprs
     void VisitExpr(const Expr *Node);
@@ -1461,6 +1462,11 @@ void ASTDumper::VisitGotoStmt(const Goto
   dumpPointer(Node->getLabel());
 }
 
+void ASTDumper::VisitCXXCatchStmt(const CXXCatchStmt *Node) {
+  VisitStmt(Node);
+  dumpDecl(Node->getExceptionDecl());
+}
+
 //===----------------------------------------------------------------------===//
 //  Expr dumping methods.
 //===----------------------------------------------------------------------===//

Modified: cfe/trunk/test/Misc/ast-dump-stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/ast-dump-stmt.cpp?rev=189941&r1=189940&r2=189941&view=diff
==============================================================================
--- cfe/trunk/test/Misc/ast-dump-stmt.cpp (original)
+++ cfe/trunk/test/Misc/ast-dump-stmt.cpp Wed Sep  4 09:35:00 2013
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s
+// RUN: %clang_cc1 -fcxx-exceptions -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s
 
 namespace n {
 void function() {}
@@ -12,3 +12,29 @@ void TestFunction() {
   Variable = 4;
 // CHECK:       DeclRefExpr{{.*}} (UsingShadow{{.*}}Variable
 }
+
+// CHECK: FunctionDecl {{.*}} TestCatch1
+void TestCatch1() {
+// CHECK:       CXXTryStmt
+// CHECK-NEXT:    CompoundStmt
+  try {
+  }
+// CHECK-NEXT:    CXXCatchStmt
+// CHECK-NEXT:      VarDecl {{.*}} x
+// CHECK-NEXT:      CompoundStmt
+  catch (int x) {
+  }
+}
+
+// CHECK: FunctionDecl {{.*}} TestCatch2
+void TestCatch2() {
+// CHECK:       CXXTryStmt
+// CHECK-NEXT:    CompoundStmt
+  try {
+  }
+// CHECK-NEXT:    CXXCatchStmt
+// CHECK-NEXT:      NULL
+// CHECK-NEXT:      CompoundStmt
+  catch (...) {
+  }
+}





More information about the cfe-commits mailing list