[libc-commits] [PATCH] D76559: [libc] Enable llvmlibc clang-tidy checks

Paula Toth via Phabricator via libc-commits libc-commits at lists.llvm.org
Sat Mar 21 18:10:34 PDT 2020


PaulkaToast created this revision.
Herald added subscribers: libc-commits, tschuett, MaskRay, aheejin.
Herald added a project: libc-project.
PaulkaToast added reviewers: sivachandra, abrachet.
PaulkaToast edited the summary of this revision.

Add  clang-tidy for llvm-libc source directory.

Example of check in action:

  /workspace/llvm-project/libc/src/string/strcpy.cpp:10:1: error: system include stdio.h not allowed [llvmlibc-restrict-system-libc-headers,-warnings-as-errors]
  #include <stdio.h>
  ^~~~~~~~~~~~~~~~~~


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76559

Files:
  libc/src/.clang-tidy
  libc/src/math/round_redirector.cpp


Index: libc/src/math/round_redirector.cpp
===================================================================
--- libc/src/math/round_redirector.cpp
+++ libc/src/math/round_redirector.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+// Include okay for this redirector.
+// NOLINTNEXTLINE(llvmlibc-restrict-system-libc-headers)
 #include <math.h>
 
 namespace __llvm_libc {
Index: libc/src/.clang-tidy
===================================================================
--- /dev/null
+++ libc/src/.clang-tidy
@@ -0,0 +1,6 @@
+Checks: '-*,llvmlibc-*'
+HeaderFilterRegex: '.*'
+WarningsAsErrors: 'llvmlibc-*'
+CheckOptions:
+  - key:             llvmlibc-restrict-system-libc-headers.Includes
+    value:           '-*, linux/*, asm/unistd.h'


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76559.251871.patch
Type: text/x-patch
Size: 801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20200322/5afb61c4/attachment.bin>


More information about the libc-commits mailing list