[PATCH] D157829: [clang-tidy] Added a new option to lambda-function-name to ignore warnings in macro expansion

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 01:00:08 PDT 2023


PiotrZSL requested changes to this revision.
PiotrZSL added a comment.
This revision now requires changes to proceed.

Missing storeOptions metod, everyting else looks +- fine.



================
Comment at: clang-tools-extra/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp:81
         Result.SourceManager->getImmediateExpansionRange(E->getLocation());
-    if (SuppressMacroExpansions.find(ER.getAsRange()) !=
-        SuppressMacroExpansions.end()) {
+    if (IgnoreMacros || SuppressMacroExpansions.find(ER.getAsRange()) !=
+                            SuppressMacroExpansions.end()) {
----------------
Better would be to check IgnoreMacros before we read ER, in separate if 


================
Comment at: clang-tools-extra/clang-tidy/bugprone/LambdaFunctionNameCheck.h:38
+      : ClangTidyCheck(Name, Context),
+        IgnoreMacros(Options.get("IgnoreMacros", DefaultIgnoreMacros)) {}
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
----------------
use getLocalOrGlobal, in future it may become more usefull


================
Comment at: clang-tools-extra/clang-tidy/bugprone/LambdaFunctionNameCheck.h:43
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 
 private:
----------------
Missing storeOptions metod


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157829



More information about the cfe-commits mailing list