[libc-commits] [PATCH] D80178: [libc] Fix accidental inclusion of system libc headers.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed May 20 23:25:48 PDT 2020


sivachandra accepted this revision.
sivachandra added inline comments.
This revision is now accepted and ready to land.


================
Comment at: libc/cmake/modules/LLVMLibCObjectRules.cmake:220
       # these.
-      COMMAND $<TARGET_FILE:clang-tidy> "--extra-arg=-fno-caret-diagnostics" --quiet
+      COMMAND $<TARGET_FILE:clang-tidy> --system-headers
+              "--extra-arg=-fno-caret-diagnostics" --quiet
----------------
PaulkaToast wrote:
> sivachandra wrote:
> > Do we still need this?
> > Normally, it should not be our business to check system headers. For example, when we add the LLVM header guard check, system headers will break?
> Ah yes, this breaks with something like `llvm-header-guard`. 
> 
> The `restrict-system-libc-header` check needs the `--system-headers` to ensure that we aren't transitively including through the compiler headers.  To solve this we can use two invocations of clang-tidy, one that just runs the `restrict-system-libc-header` check with the `--system-headers` and the other invocation would run everything else. 
Add this as a TODO and include the full reasoning you mentioned.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80178





More information about the libc-commits mailing list