clang-tidy: Don't append compiler commands if using -p

When the -p option is given to clang-tidy, it doesn't need the compile
command line to be appended. It can get everything it needs from the
compile_commands.json file in the directory specified with the -p option.
When the compiler being used is not the system default compiler,
clang-tidy has been observed to pick up the wrong headers when the
compiler command line is given, but not if only the -p option is used.
Therefore, don't append the compiler command line if -p is present in
the <LANG>_CLANG_TIDY target property.

Fixes: #24017
This commit is contained in:
Craig Scott
2022-10-06 16:14:04 +11:00
committed by Brad King
parent 1e364201e6
commit 3f4e0839c4
6 changed files with 57 additions and 10 deletions
@@ -0,0 +1,5 @@
clang-tidy-prefer-p-option
--------------------------
* If :prop_tgt:`<LANG>_CLANG_TIDY` includes a ``-p`` argument, the
full compiler command line is no longer appended after ``--``.