diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-06-29 10:43:44 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-06-29 10:43:44 +0000 |
commit | e2863eca2a8c469c4abb0cc6d0f891fd269bc5c7 (patch) | |
tree | ec0be2be59230c5a709e8c3f9ee9b751281c1d4e /clang/lib/Tooling/CompilationDatabase.cpp | |
parent | 4bcb9c334953fc62c0b10385d4d5fd72d594bafa (diff) | |
download | llvm-e2863eca2a8c469c4abb0cc6d0f891fd269bc5c7.zip llvm-e2863eca2a8c469c4abb0cc6d0f891fd269bc5c7.tar.gz llvm-e2863eca2a8c469c4abb0cc6d0f891fd269bc5c7.tar.bz2 |
[Tooling] FixedCompilationDatabase should be able to strip positional
arguments when `-fsyntax-only` is used
Previously, Clang failed to create a fixed compilation database when the
compilation arguments use -fsyntax-only instead of -c. This commit fixes the
issue by forcing Clang to look at the compilation job when stripping the
positional arguments.
Differential Revision: https://reviews.llvm.org/D34687
llvm-svn: 306659
Diffstat (limited to 'clang/lib/Tooling/CompilationDatabase.cpp')
-rw-r--r-- | clang/lib/Tooling/CompilationDatabase.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Tooling/CompilationDatabase.cpp b/clang/lib/Tooling/CompilationDatabase.cpp index 77c5b54..0e83557 100644 --- a/clang/lib/Tooling/CompilationDatabase.cpp +++ b/clang/lib/Tooling/CompilationDatabase.cpp @@ -255,10 +255,12 @@ static bool stripPositionalArgs(std::vector<const char *> Args, CompileJobAnalyzer CompileAnalyzer; for (const auto &Cmd : Jobs) { - // Collect only for Assemble jobs. If we do all jobs we get duplicates - // since Link jobs point to Assemble jobs as inputs. - if (Cmd.getSource().getKind() == driver::Action::AssembleJobClass) + // Collect only for Assemble and Compile jobs. If we do all jobs we get + // duplicates since Link jobs point to Assemble jobs as inputs. + if (Cmd.getSource().getKind() == driver::Action::AssembleJobClass || + Cmd.getSource().getKind() == driver::Action::CompileJobClass) { CompileAnalyzer.run(&Cmd.getSource()); + } } if (CompileAnalyzer.Inputs.empty()) { |