summaryrefslogtreecommitdiffstats
path: root/clang/AST
diff options
context:
space:
mode:
Diffstat (limited to 'clang/AST')
-rw-r--r--clang/AST/ExprCXX.cpp12
-rw-r--r--clang/AST/StmtPrinter.cpp9
2 files changed, 20 insertions, 1 deletions
diff --git a/clang/AST/ExprCXX.cpp b/clang/AST/ExprCXX.cpp
index 0646823af9c..3bc32e75d87 100644
--- a/clang/AST/ExprCXX.cpp
+++ b/clang/AST/ExprCXX.cpp
@@ -23,7 +23,6 @@ using namespace clang;
Stmt::child_iterator CXXCastExpr::child_begin() {
return reinterpret_cast<Stmt**>(&Op);
}
-
Stmt::child_iterator CXXCastExpr::child_end() {
return reinterpret_cast<Stmt**>(&Op)+1;
}
@@ -35,3 +34,14 @@ Stmt::child_iterator CXXBoolLiteralExpr::child_begin() {
Stmt::child_iterator CXXBoolLiteralExpr::child_end() {
return child_iterator();
}
+
+// CXXThrowExpr
+Stmt::child_iterator CXXThrowExpr::child_begin() {
+ return reinterpret_cast<Stmt**>(&Op);
+}
+Stmt::child_iterator CXXThrowExpr::child_end() {
+ // If Op is 0, we are processing throw; which has no children.
+ if (Op == 0)
+ return reinterpret_cast<Stmt**>(&Op)+0;
+ return reinterpret_cast<Stmt**>(&Op)+1;
+}
diff --git a/clang/AST/StmtPrinter.cpp b/clang/AST/StmtPrinter.cpp
index 74d94eacf62..ba82b7fcff7 100644
--- a/clang/AST/StmtPrinter.cpp
+++ b/clang/AST/StmtPrinter.cpp
@@ -780,6 +780,15 @@ void StmtPrinter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *Node) {
OS << (Node->getValue() ? "true" : "false");
}
+void StmtPrinter::VisitCXXThrowExpr(CXXThrowExpr *Node) {
+ if (Node->getSubExpr() == 0)
+ OS << "throw";
+ else {
+ OS << "throw ";
+ PrintExpr(Node->getSubExpr());
+ }
+}
+
// Obj-C
void StmtPrinter::VisitObjCStringLiteral(ObjCStringLiteral *Node) {
OpenPOWER on IntegriCloud