[libc-commits] [libc] dab219e - [libc] Enable llvmlibc clang-tidy checks

Paula Toth via libc-commits libc-commits at lists.llvm.org
Mon Mar 23 20:35:59 PDT 2020


Author: Paula Toth
Date: 2020-03-23T20:34:39-07:00
New Revision: dab219eedd29fdadf6599224c54c6fd74637cb41

URL: https://github.com/llvm/llvm-project/commit/dab219eedd29fdadf6599224c54c6fd74637cb41
DIFF: https://github.com/llvm/llvm-project/commit/dab219eedd29fdadf6599224c54c6fd74637cb41.diff

LOG: [libc] Enable llvmlibc clang-tidy checks

Summary:
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>
^~~~~~~~~~~~~~~~~~
```

Reviewers: sivachandra, abrachet

Reviewed By: sivachandra, abrachet

Subscribers: aheejin, MaskRay, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D76559

Added: 
    libc/src/.clang-tidy

Modified: 
    libc/src/math/round_redirector.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/.clang-tidy b/libc/src/.clang-tidy
new file mode 100644
index 000000000000..6d6043a11a3a
--- /dev/null
+++ b/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'

diff  --git a/libc/src/math/round_redirector.cpp b/libc/src/math/round_redirector.cpp
index 6ee074456daf..c2847c8228c3 100644
--- a/libc/src/math/round_redirector.cpp
+++ b/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 {


        


More information about the libc-commits mailing list