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

Paula Toth via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed May 20 23:06:06 PDT 2020


PaulkaToast marked an inline comment as done.
PaulkaToast added inline comments.


================
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
----------------
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. 


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