[PATCH] Implement CapturedStmt AST
Dmitri Gribenko
gribozavr at gmail.com
Tue Feb 5 12:08:00 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);
+
----------------
Please use tail allocation for this.
================
Comment at: lib/AST/Stmt.cpp:1047
@@ +1046,3 @@
+
+bool CapturedStmt::capturesVariable(const VarDecl *variable) const {
+ for (capture_const_iterator I = capture_begin(),
----------------
First letter of the parameter name should be uppercase: 'Variable'.
================
Comment at: lib/AST/StmtPrinter.cpp:452
@@ +451,3 @@
+void StmtPrinter::VisitCapturedStmt(CapturedStmt *Node) {
+ PrintStmt(Node->getSubStmt());
+}
----------------
Please add tests for this. AST printer is already broken enough and under-tested, and we should ensure that we don't make the situation worse.
http://llvm-reviews.chandlerc.com/D370
More information about the cfe-commits
mailing list