Repository: dtolnay/cxx (language: rust)

Issue:
Set up C++ linter or static analysis in CI
I haven't done a C++ project before --- is there a good linter or static analyzer that we should be running on [include/cxx.h](https://github.com/dtolnay/cxx/blob/master/include/cxx.h) and [src/cxx.cc](https://github.com/dtolnay/cxx/blob/master/src/cxx.cc) in the GitHub Actions jobs?


Discussion / hints:
I'd argue that [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) is one of the more up-to-date/complete/modern ones.

A set of [checks](https://clang.llvm.org/extra/clang-tidy/checks/list.html) also need to be enabled. The default ones probably are not enough. I recommend at least `modernize-*`, `clang-analyzer-*`and `cppcoreguidelines-*`.

I can have a look if you think clang-tidy is ok.
That would be great!

Fix patch:
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 000000000..597fa6cb6
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,2 @@
+Checks: clang-diagnostic-*,clang-analyzer-*,modernize-*,cppcoreguidelines-*,
+    -modernize-use-trailing-return-type,-cppcoreguidelines-pro-type-reinterpret-cast
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a633fd80b..209ced5e6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -94,3 +94,13 @@ jobs:
       - uses: actions/checkout@v2
       - uses: dtolnay/rust-toolchain@clippy
       - run: cargo clippy --workspace --tests -- -Dclippy::all
+
+    clang-tidy:
+      name: Clang Tidy
+      runs-on: ubuntu-latest
+      steps:
+        - uses: actions/checkout@v2
+        - name: Install clang-tidy
+          run: sudo apt install clang-tidy-10
+        - name: Run clang-tidy
+          run: clang-tidy-10 src/cxx.cc --header-filter='cxx\.h' -- -Iinclude -xc++ -std=c++11


Test patch: