Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
Checks: >
---
InheritParentConfig: true
ExtraArgs: ['-v']
FormatStyle: file
UseColor: true
WarningsAsErrors: '*'
ExcludeHeaderFilterRegex: '^(3rdparty|tvm)/.*$'

# NOTE: there must be no spaces before the '-', so put the comma last.
Checks: >-
# 1. Retained categories: easier to find bugs/performance issues
clang-analyzer-*,
cppcoreguidelines-pro-type-static-cast-downcast,
Expand Down Expand Up @@ -47,7 +56,3 @@ Checks: >
-clang-analyzer-deadcode.DeadStores,
-clang-analyzer-optin.cplusplus.VirtualCall,
-clang-diagnostic-tautological-constant-compare,

WarningsAsErrors: '*'

HeaderFilterRegex: '^(?!.*(3rdparty|build)).*$'
42 changes: 30 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,21 +287,39 @@ jobs:
echo "Clearing uv cache at ${UV_CACHE_DIR} due to failure."
uv cache clean

- name: Run format check
id: format-check
- name: Run clang-tidy
id: clang-tidy
if: runner.os == 'Linux'
run: |
mkdir -p build
echo "\$ $(command -v clang-tidy) --version" && clang-tidy --version

if [[ -x "$(command -v run-clang-tidy)" ]]; then
echo "Using run-clang-tidy from $(command -v run-clang-tidy)"
CLANG_TIDY=(run-clang-tidy)
else
echo "Downloading run-clang-tidy script"
wget -O run-clang-tidy.py https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/release/21.x/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
CLANG_TIDY=(uv run --no-project --script -- run-clang-tidy.py)
fi
if [[ -x "$(command -v clang-apply-replacements)" ]]; then
echo "Using clang-apply-replacements from $(command -v clang-apply-replacements)"
CLANG_TIDY+=(-fix -clang-apply-replacements-binary="$(command -v clang-apply-replacements)")
else
echo "::warning::clang-apply-replacements not found in PATH, automatic fixing disabled."
fi

# Run cmake to create the build directory with compile_commands.json
(
cd build
cmake .. ${CLANG_TIDY_CMAKE_OPTIONS} # no quotes here
)
cmake -S . -B cmake-build --fresh ${CLANG_TIDY_CMAKE_OPTIONS} # no quotes here

CXX_FILES=$(find src -type f -iname "*.[ch]pp" -o -iname "*.cc" -o -iname "*.c" -o -iname "*.h")
rc=0
bash format.sh || rc="$?"
rm -rf build
if [[ "${rc}" -ne 0 ]]; then
echo "::error::Format check failed. Please run 'bash format.sh' locally to fix the issues."
exit 1
"${CLANG_TIDY[@]}" -clang-tidy-binary="$(command -v clang-tidy)" \
-p="cmake-build" ${CXX_FILES} || rc="$?"
rm -rf cmake-build run-clang-tidy.py
if (( rc != 0 )); then
echo "::error::clang-tidy found issues (exit code: ${rc}). Please run 'clang-tidy --fix' locally to fix them."
git diff --color=always || true
exit "${rc}"
fi

- name: Enable core dump generation (Linux / GitHub-hosted runners)
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,7 @@ tilelang/jit/adapter/cython/.cycache

# claude
**/.claude

# CMake
cmake-build/
cmake-build-*/
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ repos:
args: [--ignore-case]
files: ^docs/spelling_wordlist\.txt$
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.7 # sync with requirements-lint.txt
rev: v21.1.2 # sync with requirements-lint.txt
hooks:
- id: clang-format
exclude: |
Expand All @@ -41,7 +41,7 @@ repos:
^.+\.json$
)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.0 # sync with requirements-lint.txt
rev: v0.14.1 # sync with requirements-lint.txt
hooks:
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix]
Expand Down
Loading
Loading