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 | c46064c2a9eea9dac5c51d038cfd8f72863e2652 (patch) | |
tree | d9e5379928d625a136dd388f88dc723c085dc784 /clang/lib/Frontend/CreateInvocationFromCommandLine.cpp | |
parent | 7417558f592f14fe15d1cb84d75f1c53487a14b2 (diff) | |
download | llvm-c46064c2a9eea9dac5c51d038cfd8f72863e2652.zip llvm-c46064c2a9eea9dac5c51d038cfd8f72863e2652.tar.gz llvm-c46064c2a9eea9dac5c51d038cfd8f72863e2652.tar.bz2 |
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
llvm-svn: 303741
Diffstat (limited to 'clang/lib/Frontend/CreateInvocationFromCommandLine.cpp')
-rw-r--r-- | clang/lib/Frontend/CreateInvocationFromCommandLine.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp index 16269064..49d459e 100644 --- a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -52,6 +52,8 @@ std::unique_ptr<CompilerInvocation> clang::createInvocationFromCommandLine( TheDriver.setCheckInputsExist(false); std::unique_ptr<driver::Compilation> C(TheDriver.BuildCompilation(Args)); + if (!C) + return nullptr; // Just print the cc1 options if -### was present. if (C->getArgs().hasArg(driver::options::OPT__HASH_HASH_HASH)) { |