]> granicus.if.org Git - clang/commitdiff
Add a helper to get a CXXConstructExpr from a CXXNewExpr.
authorMatt Beaumont-Gay <matthewbg@google.com>
Fri, 9 Mar 2012 20:36:34 +0000 (20:36 +0000)
committerMatt Beaumont-Gay <matthewbg@google.com>
Fri, 9 Mar 2012 20:36:34 +0000 (20:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152433 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/ExprCXX.h

index 4b7bfde8182db90f1c1582018291cb57acdb6636..178a9ce3e2c7cdbb938808f11cb61734496387f5 100644 (file)
@@ -1553,6 +1553,11 @@ public:
     return hasInitializer() ? cast<Expr>(SubExprs[Array]) : 0;
   }
 
+  /// \brief Returns the CXXConstructExpr from this new-expression, or NULL.
+  const CXXConstructExpr* getConstructExpr() {
+    return dyn_cast_or_null<CXXConstructExpr>(getInitializer());
+  }
+
   /// Answers whether the usual array deallocation function for the
   /// allocated type expects the size of the allocation as a
   /// parameter.