diff options
| author | Nate Begeman <natebegeman@mac.com> | 2009-08-10 23:49:36 +0000 |
|---|---|---|
| committer | Nate Begeman <natebegeman@mac.com> | 2009-08-10 23:49:36 +0000 |
| commit | 5ec4b318e3ff5a24e4f2cdaa39c1d9c6c43e92de (patch) | |
| tree | 9b75998e05d48e9afe72907e47d275c20406afc8 /clang/lib/AST/Expr.cpp | |
| parent | 3b90d973b0aae18c6780fb015195b87fbf0bd7f1 (diff) | |
| download | bcm5719-llvm-5ec4b318e3ff5a24e4f2cdaa39c1d9c6c43e92de.tar.gz bcm5719-llvm-5ec4b318e3ff5a24e4f2cdaa39c1d9c6c43e92de.zip | |
Take 2 on AltiVec-style vector initializers.
Fixes PR4704 problems
Addresses Eli's patch feedback re: ugly cast code
Updates all postfix operators to remove ParenListExprs. While this is awful,
no better solution (say, in the parser) is obvious to me. Better solutions
welcome.
llvm-svn: 78621
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 2c07de6c79a..ce8bb516c09 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -1784,6 +1784,26 @@ void DesignatedInitExpr::DoDestroy(ASTContext &C) { Expr::DoDestroy(C); } +ParenListExpr::ParenListExpr(ASTContext& C, SourceLocation lparenloc, + Expr **exprs, unsigned nexprs, + SourceLocation rparenloc) +: Expr(ParenListExprClass, QualType(), + hasAnyTypeDependentArguments(exprs, nexprs), + hasAnyValueDependentArguments(exprs, nexprs)), + NumExprs(nexprs), LParenLoc(lparenloc), RParenLoc(rparenloc) { + + Exprs = new (C) Stmt*[nexprs]; + for (unsigned i = 0; i != nexprs; ++i) + Exprs[i] = exprs[i]; +} + +void ParenListExpr::DoDestroy(ASTContext& C) { + DestroyChildren(C); + if (Exprs) C.Deallocate(Exprs); + this->~ParenListExpr(); + C.Deallocate(this); +} + //===----------------------------------------------------------------------===// // ExprIterator. //===----------------------------------------------------------------------===// @@ -1988,6 +2008,14 @@ Stmt::child_iterator ImplicitValueInitExpr::child_end() { return child_iterator(); } +// ParenListExpr +Stmt::child_iterator ParenListExpr::child_begin() { + return &Exprs[0]; +} +Stmt::child_iterator ParenListExpr::child_end() { + return &Exprs[0]+NumExprs; +} + // ObjCStringLiteral Stmt::child_iterator ObjCStringLiteral::child_begin() { return &String; |

