[PATCH] Improved capturing variable-length array types in CapturedStmt.

hfinkel at anl.gov hfinkel at anl.gov
Tue Oct 7 07:33:55 PDT 2014


================
Comment at: include/clang/AST/Stmt.h:2044
@@ -2031,1 +2043,3 @@
+      assert(capturesVariable() &&
+             "No variable available for 'this' or VAT capture");
       return VarAndKind.getPointer();
----------------
VAT? Do you mean VLA?

================
Comment at: lib/AST/Decl.cpp:3274
@@ -3269,1 +3273,3 @@
+    return !getDeclContext()->isRecord() ||
+           !isVLATypeCapturingAllowed(getParent());
   }
----------------
Calling this function here seems confusing because this has nothing to do with VLAs.

================
Comment at: lib/AST/Decl.cpp:3564
@@ +3563,3 @@
+bool RecordDecl::isCapturedRecord() const {
+  return getTagKind() == TTK_Struct && getLocStart() == getLocation() &&
+         getIdentifier() == nullptr && isImplicit() &&
----------------
Is testing the source location really necessary here? That seems fragile.

================
Comment at: lib/CodeGen/CGStmt.cpp:2161
@@ +2160,3 @@
+      auto *ExprArg = EmitLoadOfLValue(EmitLValueForField(Base, FD),
+                                       SourceLocation()).getScalarVal();
+      auto VAT = FD->getCapturedVLAType();
----------------
Why not use Loc (S.getLocStart()) as the source location?

http://reviews.llvm.org/D5099






More information about the cfe-commits mailing list