[cfe-commits] r150394 - /cfe/trunk/lib/AST/ExprCXX.cpp

Douglas Gregor dgregor at apple.com
Mon Feb 13 07:51:35 PST 2012


Author: dgregor
Date: Mon Feb 13 09:51:35 2012
New Revision: 150394

URL: http://llvm.org/viewvc/llvm-project?rev=150394&view=rev
Log:
Don't allocate unused storage for captures/capture initializers in lambda expressions

Modified:
    cfe/trunk/lib/AST/ExprCXX.cpp

Modified: cfe/trunk/lib/AST/ExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=150394&r1=150393&r2=150394&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Mon Feb 13 09:51:35 2012
@@ -781,13 +781,10 @@
   // 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 {





More information about the cfe-commits mailing list