diff options
Diffstat (limited to 'contrib/llvm-project/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp')
| -rw-r--r-- | contrib/llvm-project/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/contrib/llvm-project/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/contrib/llvm-project/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp index b62416ffd9e7..18c4814bbd5c 100644 --- a/contrib/llvm-project/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/contrib/llvm-project/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -24,14 +24,10 @@ using namespace clang; using namespace llvm::opt; -/// createInvocationFromCommandLine - Construct a compiler invocation object for -/// a command line argument vector. -/// -/// \return A CompilerInvocation, or 0 if none was built for the given -/// argument vector. std::unique_ptr<CompilerInvocation> clang::createInvocationFromCommandLine( ArrayRef<const char *> ArgList, IntrusiveRefCntPtr<DiagnosticsEngine> Diags, - IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) { + IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS, bool ShouldRecoverOnErorrs, + std::vector<std::string> *CC1Args) { if (!Diags.get()) { // No diagnostics engine was provided, so create our own diagnostics object // with the default options. @@ -94,12 +90,11 @@ std::unique_ptr<CompilerInvocation> clang::createInvocationFromCommandLine( } const ArgStringList &CCArgs = Cmd.getArguments(); - auto CI = llvm::make_unique<CompilerInvocation>(); - if (!CompilerInvocation::CreateFromArgs(*CI, - const_cast<const char **>(CCArgs.data()), - const_cast<const char **>(CCArgs.data()) + - CCArgs.size(), - *Diags)) + if (CC1Args) + *CC1Args = {CCArgs.begin(), CCArgs.end()}; + auto CI = std::make_unique<CompilerInvocation>(); + if (!CompilerInvocation::CreateFromArgs(*CI, CCArgs, *Diags) && + !ShouldRecoverOnErorrs) return nullptr; return CI; } |
