[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

Richard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 17 09:38:37 PDT 2022


LegalizeAdulthood added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp:90
+  // to the `ASTContext`.
+  Finder->addMatcher(ast_matchers::translationUnitDecl().bind("TU"), this);
+}
----------------
In modernize-macro-to-enum I had to similarly discard macros defined inside a top-level decl.  I did `decl(hasParent(translationUnitDecl()))` to match the top-level decls.  Would that simplify your check as well?


================
Comment at: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp:123
 
-IncludeModernizePPCallbacks::IncludeModernizePPCallbacks(ClangTidyCheck &Check,
-                                                         LangOptions LangOpts)
+detail::IncludeModernizePPCallbacks::IncludeModernizePPCallbacks(
+    DeprecatedHeadersCheck &Check, LangOptions LangOpts)
----------------
IMO it's poor style to define entities that are declared within a namespace outside the namespace within which they were declared.

Is there some reason this isn't defined with the rest of the methods on the callback class?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125209



More information about the cfe-commits mailing list