[PATCH] Implement CapturedStmt AST

Dmitri Gribenko gribozavr at gmail.com
Tue Feb 5 13:11:42 PST 2013



================
Comment at: lib/AST/Stmt.cpp:1040-1042
@@ +1039,5 @@
+  // Copy all Capture objects into the context.
+  unsigned Size = NumCaptures * sizeof(Capture);
+  void *buffer = Context.Allocate(Size, llvm::alignOf<Capture *>());
+  memcpy(buffer, begin, Size);
+
----------------
Wei Pan wrote:
> Dmitri Gribenko wrote:
> > Please use tail allocation for this.
> This was following the implementation of BlockDecl and LambdaExpr. What do you mean tail allocation here?
Tail allocation = allocate memory for this array after the CapturedStmt object itself, to improve data locality. Please take a look at CXXTryStmt::Create, for example.


http://llvm-reviews.chandlerc.com/D370



More information about the cfe-commits mailing list