[PATCH] D139113: Fix a couple additional cases in misc-use-anonymous-namespace only

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 1 12:24:22 PST 2022


carlosgalvezp marked 2 inline comments as done.
carlosgalvezp added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/misc/UseAnonymousNamespaceCheck.cpp:44
+  const SourceManager &SM = MatchedDecl->getASTContext().getSourceManager();
+  if (!SM.isWrittenInMainFile(MatchedDecl->getLocation()))
+    return;
----------------
njames93 wrote:
> The logic would fall apart when run in clangd or unity builds. The safest way is generally to match the file extension, we have a class for it in `clang-tidy/utils`
Great suggestion, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139113



More information about the cfe-commits mailing list