From: Nate Begeman Date: Wed, 12 Aug 2009 02:10:25 +0000 (+0000) Subject: Fix a fixme by allocating ShuffleVectorExprs in the Context X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a88dc3079bedf70a5cfc39791727e43a10383006;p=clang Fix a fixme by allocating ShuffleVectorExprs in the Context git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78780 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 3def5721ab..745ba26f70 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -1727,13 +1727,13 @@ class ShuffleVectorExpr : public Expr { unsigned NumExprs; public: - ShuffleVectorExpr(Expr **args, unsigned nexpr, + ShuffleVectorExpr(ASTContext &C, Expr **args, unsigned nexpr, QualType Type, SourceLocation BLoc, SourceLocation RP) : Expr(ShuffleVectorExprClass, Type), BuiltinLoc(BLoc), RParenLoc(RP), NumExprs(nexpr) { - // FIXME: Allocate in ASTContext! - SubExprs = new Stmt*[nexpr]; + + SubExprs = new (C) Stmt*[nexpr]; for (unsigned i = 0; i < nexpr; i++) SubExprs[i] = args[i]; } diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index b35287aa31..ffe4abd731 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -626,8 +626,8 @@ Action::OwningExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) { TheCall->setArg(i, 0); } - return Owned(new (Context) ShuffleVectorExpr(exprs.begin(), exprs.size(), - exprs[0]->getType(), + return Owned(new (Context) ShuffleVectorExpr(Context, exprs.begin(), + exprs.size(), exprs[0]->getType(), TheCall->getCallee()->getLocStart(), TheCall->getRParenLoc())); }