[PATCH] D75332: [clang-tidy] Add module for llvm-libc and restrict-system-libc-header-check.

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 1 01:58:20 PST 2020


njames93 added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp:40
+    SrcMgr::CharacteristicKind FileType) {
+  if (SrcMgr::isSystem(FileType)) {
+    if (!SM.isInMainFile(HashLoc)) {
----------------
abrachet wrote:
> Could you whitelist the freestanding/compiler provided headers like stddef, stdatomic...
Or have a user configurable whitelist 


================
Comment at: clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp:42
+    if (!SM.isInMainFile(HashLoc)) {
+      auto D = Check.diag(
+          HashLoc,
----------------
Don't use auto when the type isn't an iterator or spelled out on the initialisation. 


================
Comment at: clang-tools-extra/clang-tidy/llvmlibc/RestrictSystemLibcHeadersCheck.cpp:47
+    } else {
+      auto D = Check.diag(HashLoc, "system libc header %0 not allowed");
+      D << FileName;
----------------
Ditto


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75332





More information about the cfe-commits mailing list