diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-02-13 15:51:35 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-02-13 15:51:35 +0000 |
commit | 908a595945cbcbdb0232cec8ce61b0eeb5c17ff6 (patch) | |
tree | fdef916c6b5f7e33ffd91321f3004bd71e4cb49d /lib/AST/ExprCXX.cpp | |
parent | da8962a6198bc4bf09a38209db99551b2b0a41a0 (diff) |
Don't allocate unused storage for captures/capture initializers in lambda expressions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150394 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprCXX.cpp')
-rw-r--r-- | lib/AST/ExprCXX.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index 29ff69d312..1f8a57a4e3 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -781,13 +781,10 @@ LambdaExpr *LambdaExpr::Create(ASTContext &Context, // Determine the type of the expression (i.e., the type of the // function object we're creating). QualType T = Context.getTypeDeclType(Class); - size_t Size = sizeof(LambdaExpr) + sizeof(Capture) * Captures.size() - + sizeof(Stmt *) * (Captures.size() + 1); - void *Mem = Context.Allocate(Size, llvm::alignOf<LambdaExpr>()); - return new (Mem) LambdaExpr(T, IntroducerRange, CaptureDefault, - Captures, ExplicitParams, CaptureInits, - ClosingBrace); + return new (Context) LambdaExpr(T, IntroducerRange, CaptureDefault, + Captures, ExplicitParams, CaptureInits, + ClosingBrace); } LambdaExpr::capture_iterator LambdaExpr::capture_begin() const { |