Add new 'CXXConditionDeclExpr' expression node used for a 'condition' declaration, e.g: "if (int x=0) {...}".
It is a subclass of DeclRefExpr and the main difference is that CXXConditionDeclExpr owns the declaration that it references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56033 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp
index cf85ae2..2ad6545 100644
--- a/lib/AST/ExprCXX.cpp
+++ b/lib/AST/ExprCXX.cpp
@@ -14,6 +14,12 @@
#include "clang/AST/ExprCXX.h"
using namespace clang;
+void CXXConditionDeclExpr::Destroy(ASTContext& C) {
+ getVarDecl()->Destroy(C);
+ delete this;
+}
+
+
//===----------------------------------------------------------------------===//
// Child Iterators for iterating over subexpressions/substatements
//===----------------------------------------------------------------------===//
@@ -53,3 +59,11 @@
Stmt::child_iterator CXXZeroInitValueExpr::child_end() {
return child_iterator();
}
+
+// CXXConditionDeclExpr
+Stmt::child_iterator CXXConditionDeclExpr::child_begin() {
+ return getVarDecl();
+}
+Stmt::child_iterator CXXConditionDeclExpr::child_end() {
+ return child_iterator();
+}