MaskRay added a comment. > `RestrictSystemLibcHeadersCheck`
As I commented previously, I think the checker name should be generalized, as it does not need to be coupled with llvm-libc. Other projects may have similar needs. For example, they don't want to accidentally include a system zlib.h -> they may ship a bundled zlib (say, in third_party/zlib/). Maybe `misc/` (or `portability/`) is more suitable? ================ Comment at: clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp:49 + if (SrcMgr::isSystem(FileType)) { + // Compiler provided headers are allowed (e.g stddef.h). + if (SearchPath == CompilerIncudeDir) { ---------------- This is actually an interesting topic. On FreeBSD and linux-musl, stdalign.h stdarg.h stdbool.h stddef.h stdint.h stdnoreturn.h are provided by libc instead. After D65699, ``` % clang -fsyntax-only -target x86_64-linux-musl -v /tmp/c/a.c ... #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/include/x86_64-linux-gnu /usr/include /tmp/ReleaseA/lib/clang/11.0.0/include End of search list. ``` Note that the $resource_dir/include is after libc search directories on a Linux glibc (x86_64-linux-gnu) system. Using a compiler intrinsic file (e.g. `x86intrin.h`) may be less controversial. It leaves to llvm-libc to decide which ordering is better. (I lean toward FreeBSD/linux musl way.) ================ Comment at: clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp:52 + return; + } + if (!SM.isInMainFile(HashLoc)) { ---------------- Drop excess parentheses. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75332/new/ https://reviews.llvm.org/D75332 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits