[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:35:05 PST 2021


njames93 created this revision.
njames93 added reviewers: alexfh, aaron.ballman, JonasToth, rsmith, MyDeveloperDay.
Herald added subscribers: martong, xazax.hun.
Herald added a reviewer: shafik.
njames93 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Currently these checks will overwrite the default capture token (=|&) if any default captures refer to decls that need fixing.
There was an a previous patch (D59540 <https://reviews.llvm.org/D59540>) that tried to address this shortfall but it went about it trying to detect if it was inside a lambda then comparing the textual representation.
Learning from the previous its obvious that we need someway to tag a DeclRefExpr.
I've settled on `RefersToDefaultCapture` for now, but there could be a case to make it `IsImplicit`, for when a DeclRefExpr isn't actually written.
If anyone can think of good examples when this could happen I'd definitely support that instead.
Right now I've only addressed lambdas as I don't know anything about ObjectiveC Blocks, If this makes sense there I'd be happy to extend it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97653

Files:
  clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
  clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp
  clang/include/clang/AST/Expr.h
  clang/include/clang/AST/Stmt.h
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Expr.cpp
  clang/lib/Sema/SemaLambda.cpp
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriterDecl.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97653.327014.patch
Type: text/x-patch
Size: 7600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210301/670389ed/attachment-0001.bin>


More information about the cfe-commits mailing list