aengelke wrote:

The test is failing, because clang-tidy for this test picks up the 
compile_commands.json file used to build LLVM. If the LLVM build happens to use 
PCH, it will try to use the same PCH for the source in the test. This is 
fundamentally wrong and shouldn't happen and is *not* a problem of the PCH 
build itself -- the PCH build just exposes this long-standing problem. It 
really is a problem of clang/Tooling and/or the way the test is written. I'm 
therefore opposed to reverting, because this problem is known since 1.5 months 
and nobody did anything to fix the underlying causes or make the test more 
robust.

> Could you please explain what exactly matchers right now and how it breaks?

My understanding is: clang-tidy tries to find compilation commands. The source 
file resides in the build directory, so it goes upwards and find the 
compile_commands.json in the root of the build directory (the one generated by 
CMake for the LLVM build). There's no file cqc-main.cpp in there, so it tries 
to find a close match in the file (see pickWinner in 
InterpolatingCompilationDatabase.cpp). In this case, it hits the score=0 case 
and uses the cpp file with the longest prefix match, which is the result 
described in the commit message.

> Do we run PCH as part of the premerge checks or is there another way to 
> verify this (I don't run PCH build locally)?

We don't do PCH builds in pre-commit CI to catch missed includes and permit the 
use of sccache. But you should be able to add flags to the LLVM build 
configuration and check that they don't get picked up in the source file.

> If the tests is failing because of guessing incorrect flags in 
> compiler_commands.json, I think one of the solution would to create a temp 
> dir with predefined compiler_commands.json so that test will always pick it.

Like this?

https://github.com/llvm/llvm-project/pull/191635
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to