Conversation
This makes sure clang and clang-tidy have the same version so clang-tidy works with pre-compiled headers. Otherwise, I got: ``` error: PCH file uses a newer PCH format that cannot be read [clang-diagnostic-error] ```
|
Review updated until commit 759f66b Description
|
| Relevant files | |||||||
|---|---|---|---|---|---|---|---|
| Enhancement |
| ||||||
| Configuration changes |
|
PR Reviewer Guide
Here are some key observations to aid the review process:
| 🧪 PR contains tests |
| ⚡ Recommended focus areas for review |
Missing llvm-config fallback
|
Greptile SummaryThis PR resolves PCH format incompatibility by ensuring Key changes:
Notes:
Confidence Score: 4/5
Important Files Changed
Last reviewed commit: 759f66b |
mdavis36
left a comment
There was a problem hiding this comment.
You will likely get an error with clang-tidy still w/ PCH. We need to have lintrunner use the clang-tidy-19 executable otherwise it will throw a different error:
❯ lintrunner --take CLANGTIDY --force-color csrc/type_promotion.cpp
CLANGTIDY failure
>>> Lint for csrc/type_promotion.cpp:
Error (CLANGTIDY) command-failed
Failed due to Command '['/home/dev/.local/bin/clang-tidy', '-p=/home/dev/
workspace/Fuser/python/build', '--extra-arg', '-I/usr/lib/llvm-11/include/
openmp', '--extra-arg', '-I/usr/include/python3.12', '--extra-arg', '-I/
home/dev/workspace/Fuser/third_party/pybind11/include', '--extra-arg',
'-I/usr/include/c++/13', '--extra-arg', '-I/usr/include/x86_64-linux-
gnu/c++/13', '--extra-arg', '-I/usr/include/c++/13/backward', '--extra-
arg', '-I/usr/lib/gcc/x86_64-linux-gnu/13/include', '--extra-arg',
'-I/usr/local/include', '--extra-arg', '-I/usr/include/x86_64-linux-
gnu', '--extra-arg', '-I/usr/include', '/home/dev/workspace/Fuser/csrc/
type_promotion.cpp']' returned non-zero exit status 1.
stdout:
error: PCH file '/home/dev/workspace/Fuser/python/build/CMakeFiles/
codegen_internal.dir/cmake_pch.hxx.pch' built from a different branch
((0ubuntu1~24.04.2)) than the compiler () [clang-diagnostic-error]
stderr:
1 error generated.
Error while processing /home/dev/workspace/Fuser/csrc/type_promotion.cpp.
Found compiler error(s).
From claude on why (I use 20 for no particular reason, and was trying this w/ 20 versions on my system):
the PCH was built by a system-packaged clang-20 (0ubuntu1~24.04.2 branch) while the pip-installed clang-tidy 20.1.0 is a vanilla upstream build with no branch string. They're technically different builds of clang-20, so the PCH is still incompatible.
Removing the init command and specifying the system binary fixed this for me.
178 -init_command = [
179 - 'python3',
180 - 'tools/linter/adapters/pip_init.py',
181 - '--dry-run={{DRYRUN}}',
182 - 'clang-tidy==19.1.0.1',
183 -]
178 command = [
179 'python3',
180 'tools/linter/adapters/clangtidy_linter.py',
181 - '--binary=~/.local/bin/clang-tidy',
181 + '--binary=/usr/bin/clang-tidy-20',
182 '--build_dir=./python/build',
183 '--',
184 '@{{PATHSFILE}}'
Yes, I planned to fix that in multiple PRs. However, that lost the important context so I decided to include more. |
Additional Comments (1)
On POSIX, This means when The previous code had |
| # "/usr/local/cuda-13.0/targets/x86_64-linux/include". I'll try to add that in | ||
| # a future PR. | ||
| include_dir = [ | ||
| "/usr/lib/llvm-11/include/openmp", |
|
!build |
| from typing import Any, List, NamedTuple, Optional | ||
|
|
||
|
|
||
| IS_WINDOWS: bool = os.name == "nt" |
|
!build |
|
!build |
...so clang-tidy and clang-format work with pre-compiled headers. Otherwise, I got
when I
lintrunner.Also cc @rdspring1 who wrote the initial code