[PATCH] D48845: [Sema] Add fixit for unused lambda captures

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 12 13:24:23 PDT 2018


aaron.ballman added inline comments.


================
Comment at: include/clang/Sema/DeclSpec.h:2552-2553
     ParsedType InitCaptureType;
+    SourceLocation LocStart;
+    SourceLocation LocEnd;
+
----------------
How does `LocStart` relate to the existing source location `Loc`? I think this should have a more descriptive name of what location is involved.


================
Comment at: lib/Sema/SemaLambda.cpp:827
                   Var->getType(), Var->getInit());
+
   return Field;
----------------
Spurious whitespace change can be removed.


================
Comment at: lib/Sema/SemaLambda.cpp:1553
+      SourceRange CaptureRange = LSI->ExplicitCaptureRanges[I];
+      if (CaptureRange.isInvalid()) {
+        CaptureRange = SourceRange(From.getLocation());
----------------
Can elide braces.


================
Comment at: test/FixIt/fixit-unused-lambda-capture.cpp:64-66
+    [*this] {};
+    // CHECK: [] {};
+    [*this,i] { return i; };
----------------
I'd like to see some tests where the `this` and `*this` captures are not removed by the fix.


Repository:
  rC Clang

https://reviews.llvm.org/D48845





More information about the cfe-commits mailing list