[libc-commits] [PATCH] D76744: [clang-tidy] Add check to ensure llvm-libc implementations are defined in correct namespace.

Paula Toth via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Mar 25 18:58:18 PDT 2020


PaulkaToast marked 3 inline comments as done.
PaulkaToast added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/llvmlibc/EntrypointNamespaceCheck.cpp:67
+  if (Result.SourceManager->getFilename(MatchedDecl->getLocation())
+          .endswith(".h"))
+    return;
----------------
njames93 wrote:
> Is there a rule that all libc implementation headers must have the extension `.h`. If not there is `utils::FileExtensionSet` that could be used.
> Alternatively you could just check to see if the SourceLocation is in the main file
> `if (!Result.SourceManager->isInMainFile(MatchedDecl->getLocation())`
Thanks for this! I incorporated your recommendations in the new patch. (:


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76744





More information about the libc-commits mailing list