[PATCH] D18139: [Cxx1z] Implement Lambda Capture of *this by Value as [=, *this] (P0018R3)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 18 08:30:07 PDT 2016


rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


================
Comment at: include/clang/AST/LambdaCapture.h:48
@@ +47,3 @@
+  //   by value or reference.
+  // - or, points to the VLASentinel if this represents a by VLA capture.
+  llvm::PointerIntPair<void*, 2> CapturedEntityAndBits;
----------------
"by VLA capture" -> "capture of a VLA type"?

================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5982
@@ +5981,3 @@
+
+  // C++1z star-this captures.
+  def warn_cxx14_compat_star_this_lambda_capture : Warning<
----------------
star-this -> *this

================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5984-5987
@@ -5981,1 +5983,6 @@
+  def warn_cxx14_compat_star_this_lambda_capture : Warning<
+    "by value capture of '*this' is incompatible with C++ standards before C++1z">,
+     InGroup<CXXPre1zCompat>, DefaultIgnore;
+  def ext_star_this_lambda_capture_cxx1z : ExtWarn<
+    "by value capture of '*this' is a C++1z extension">, InGroup<CXX1z>;
 }
----------------
by value capture of '*this' -> capture of '*this' by copy

================
Comment at: lib/Sema/SemaExprCXX.cpp:994
@@ -926,2 +993,3 @@
           CSI->ImpCaptureStyle == CapturingScopeInfo::ImpCap_CapturedRegion ||
-          Explicit) {
+          UseExplicitFlag) {
+        assert(!UseExplicitFlag || idx == MaxFunctionScopesIndex);
----------------
You don't need this flag; instead, check `Explicit && idx == MaxFunctionScopesIndex` here.

================
Comment at: lib/Sema/SemaExprCXX.cpp:1033
@@ +1032,3 @@
+      ThisExpr = captureThis(*this, Context, LSI->Lambda, ThisTy, Loc,
+                             UseByCopyFlag);
+      // If we must capture the *enclosing object* in outer lambdas, they must
----------------
Likewise here.


http://reviews.llvm.org/D18139





More information about the cfe-commits mailing list