Skip to content

[libc++] run clang-tidy on src/ in the CI #121198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 15, 2025

Conversation

philnik777
Copy link
Contributor

@philnik777 philnik777 commented Dec 27, 2024

This adds a new test to run clang-tidy on the src/ directory and temporarily disables and clang-tidy checks that currently fail. They will be enabled in follow-up patches.

@philnik777 philnik777 force-pushed the src_enable_clang_tidy branch 4 times, most recently from e93c269 to cf8ae75 Compare January 1, 2025 12:39
@philnik777 philnik777 marked this pull request as ready for review January 2, 2025 16:25
@philnik777 philnik777 requested a review from a team as a code owner January 2, 2025 16:25
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jan 2, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 2, 2025

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/121198.diff

2 Files Affected:

  • (modified) libcxx/src/.clang-tidy (+15-1)
  • (modified) libcxx/utils/ci/run-buildbot (+3)
diff --git a/libcxx/src/.clang-tidy b/libcxx/src/.clang-tidy
index ec8f2e0a76a3c4..3d5493d965558e 100644
--- a/libcxx/src/.clang-tidy
+++ b/libcxx/src/.clang-tidy
@@ -1,4 +1,18 @@
 InheritParentConfig: true
 
 Checks: >
-  -readability-identifier-naming
+  -clang-analyzer-*,
+
+  -llvm-include-order,
+
+  -modernize-loop-convert,
+  -modernize-use-equals-delete,
+  -modernize-use-nullptr,
+  -modernize-use-override,
+
+  -readability-identifier-naming,
+  -readability-function-cognitive-complexity,
+  -readability-function-size,
+  -readability-simplify-boolean-expr,
+
+# TODO: Consider enabling clang-analyzer. Without the checks clang-tidy runs 18x faster on my system.
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index f1ede6474eb9ee..4070b7f9211963 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -144,6 +144,7 @@ function generate-cmake() {
     generate-cmake-base \
           -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
           -DLIBCXX_CXX_ABI=libcxxabi \
+          -DCMAKE_EXPORT_COMPILE_COMMANDS=On \
           "${@}"
 }
 
@@ -328,6 +329,8 @@ generic-cxx26)
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx26.cmake"
     check-runtimes
     check-abi-list
+    python3 $MONOREPO_ROOT/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py \
+        -clang-tidy-binary clang-tidy-20 -warnings-as-errors \* -source-filter ".*libcxx/src.*" -p "${BUILD_DIR}"
 ;;
 #
 # Other compiler support

@philnik777 philnik777 force-pushed the src_enable_clang_tidy branch from cf8ae75 to 8dafe63 Compare February 25, 2025 12:58
Copy link

github-actions bot commented Feb 25, 2025

✅ With the latest revision this PR passed the Python code formatter.

@philnik777 philnik777 force-pushed the src_enable_clang_tidy branch 2 times, most recently from 3fea1ac to 21ace2f Compare May 14, 2025 07:26
@philnik777 philnik777 force-pushed the src_enable_clang_tidy branch from 21ace2f to c0ef730 Compare May 14, 2025 07:30
@philnik777 philnik777 merged commit fbdf38e into llvm:main May 15, 2025
12 of 16 checks passed
@philnik777 philnik777 deleted the src_enable_clang_tidy branch May 15, 2025 08:34
TIFitis pushed a commit to TIFitis/llvm-project that referenced this pull request May 19, 2025
This adds a new test to run clang-tidy on the `src/` directory and
temporarily disables and clang-tidy checks that currently fail. They
will be enabled in follow-up patches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants