[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
This commit is contained in:
Paula Toth 2020-03-23 20:33:56 -07:00
parent 816ad48c82
commit dab219eedd
2 changed files with 8 additions and 0 deletions

6
libc/src/.clang-tidy Normal file
View File

@ -0,0 +1,6 @@
Checks: '-*,llvmlibc-*'
HeaderFilterRegex: '.*'
WarningsAsErrors: 'llvmlibc-*'
CheckOptions:
- key: llvmlibc-restrict-system-libc-headers.Includes
value: '-*, linux/*, asm/unistd.h'

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// Include okay for this redirector.
// NOLINTNEXTLINE(llvmlibc-restrict-system-libc-headers)
#include <math.h>
namespace __llvm_libc {