This change fixes the problem in https://bugs.llvm.org/show_bug.cgi?id=38332
by allowing driver::Action::BackendJobClass to run with the analyzer.
Otherwise, such jobs will look up the non-existing compilation database and then run without flags.
Also filter out the -Wa,* flags that could be passed to and ignored by the clang compiler.
Clang-tidy gives warnings about unused -Wa,* flags.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Tooling/CompilationDatabase.cpp | ||
---|---|---|
304 ↗ | (On Diff #161578) | It seems to me that BackendJob will always be preceded by a CompileJob (according to https://github.com/llvm-mirror/clang/blob/master/lib/Driver/Driver.cpp#L3506), so at least of one job would be CompileJobClass here. Not sure if I understood it correctly though. Would you mind clarify? |
I tested with clang-tidy test.cpp -- -c -Iinc -flto,
and found that in Driver.cpp:getTool Inputs has one action equal to
BackendJobClass (without -flto) or CompileJobClass (with -flto).
When in CompilationDatabase:stripPositionalArgs, the Jobs has only one
AssembleJobClass (without -flto) or BackendJobClass (with -flto).
It is confusing to change the Backend/Compile to Assemble/Backend.
However, I have not seen multiple jobs yet.
Do you have a test case that could trigger multiple jobs with or without -flto?
lib/Tooling/CompilationDatabase.cpp | ||
---|---|---|
304 ↗ | (On Diff #161578) | Is the difference here because clang driver != clang-tidy driver? |
lib/Tooling/CompilationDatabase.cpp | ||
---|---|---|
304 ↗ | (On Diff #161578) | The drivers are different but share some logic. This part is not used by clang driver. |
Not really. I'm not familiar with backend jobs and just wanted to ask for clarification. Thanks!
lib/Tooling/CompilationDatabase.cpp | ||
---|---|---|
172 ↗ | (On Diff #161578) | Do we also need to something for BackendJob here? |