[PATCH] D97653: [clang-tidy] Fix RenamerClangTidy checks breaking lambda captures.

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 28 18:38:24 PST 2021


njames93 added a comment.

Where would be a good place for testing refersToDefaultCapture support?



================
Comment at: clang/lib/Sema/SemaLambda.cpp:1619
+  if (Cap.isVariableCapture() && ImplicitCaptureLoc.isValid())
+    cast<DeclRefExpr>(InitExpr)->setRefersToDefaultCapture(true);
   InitializedEntity Entity = InitializedEntity::InitializeLambdaCapture(
----------------
Correct me if I'm wrong, but there shouldn't be a case where the assert in cast fails.


================
Comment at: clang/lib/Serialization/ASTWriterDecl.cpp:2285-2286
   Abv->Add(BitCodeAbbrevOp(0)); // RefersToEnclosingVariableOrCapture
+  Abv->Add(
+      BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // RefersToDefaultCapture
   Abv->Add(BitCodeAbbrevOp(0)); // NonOdrUseReason
----------------
I have no idea about BitcodeWriter, is this correct or should I just be using the literal abbreviation?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97653/new/

https://reviews.llvm.org/D97653



More information about the cfe-commits mailing list