diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2017-05-24 11:57:37 +0000 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2017-05-24 11:57:37 +0000 |
commit | 5bfd35d62f24a6013bbb2a7a2b78338f158d2b4a (patch) | |
tree | 47e7c6ed549340d393b27de16803a91f098dcdf1 /lib/Tooling/Tooling.cpp | |
parent | eaa2b10ecb6c19ac50b204c4c62e99434234bb80 (diff) | |
download | clang-5bfd35d62f24a6013bbb2a7a2b78338f158d2b4a.tar.gz |
Method loadFromCommandLine should be able to report errors
Now FixedCompilationDatabase::loadFromCommandLine has no means to report
which error occurred if it fails to create compilation object. This is
a block for implementing D33013, because after that change driver will
refuse to create compilation if command line contains erroneous options.
This change adds additional argument to loadFromCommandLine, which is
assigned error message text if compilation object was not created. This is
the same way as other methods of CompilationDatabase report failure.
Differential Revision: https://reviews.llvm.org/D33272
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303741 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Tooling/Tooling.cpp')
-rw-r--r-- | lib/Tooling/Tooling.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Tooling/Tooling.cpp b/lib/Tooling/Tooling.cpp index 9e1181281f..2e093dd9af 100644 --- a/lib/Tooling/Tooling.cpp +++ b/lib/Tooling/Tooling.cpp @@ -260,6 +260,8 @@ bool ToolInvocation::run() { Driver->setCheckInputsExist(false); const std::unique_ptr<clang::driver::Compilation> Compilation( Driver->BuildCompilation(llvm::makeArrayRef(Argv))); + if (!Compilation) + return false; const llvm::opt::ArgStringList *const CC1Args = getCC1Arguments( &Diagnostics, Compilation.get()); if (!CC1Args) { |