|
24 | 24 | using namespace clang;
|
25 | 25 | using namespace llvm::opt;
|
26 | 26 |
|
27 |
| -/// createInvocationFromCommandLine - Construct a compiler invocation object for |
28 |
| -/// a command line argument vector. |
29 |
| -/// |
30 |
| -/// \return A CompilerInvocation, or 0 if none was built for the given |
31 |
| -/// argument vector. |
32 | 27 | std::unique_ptr<CompilerInvocation> clang::createInvocationFromCommandLine(
|
33 | 28 | ArrayRef<const char *> ArgList, IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
|
34 |
| - IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) { |
| 29 | + IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS, bool ShouldRecoverOnErorrs) { |
35 | 30 | if (!Diags.get()) {
|
36 | 31 | // No diagnostics engine was provided, so create our own diagnostics object
|
37 | 32 | // with the default options.
|
@@ -95,11 +90,10 @@ std::unique_ptr<CompilerInvocation> clang::createInvocationFromCommandLine(
|
95 | 90 |
|
96 | 91 | const ArgStringList &CCArgs = Cmd.getArguments();
|
97 | 92 | auto CI = std::make_unique<CompilerInvocation>();
|
98 |
| - if (!CompilerInvocation::CreateFromArgs(*CI, |
99 |
| - const_cast<const char **>(CCArgs.data()), |
100 |
| - const_cast<const char **>(CCArgs.data()) + |
101 |
| - CCArgs.size(), |
102 |
| - *Diags)) |
| 93 | + if (!CompilerInvocation::CreateFromArgs( |
| 94 | + *CI, const_cast<const char **>(CCArgs.data()), |
| 95 | + const_cast<const char **>(CCArgs.data()) + CCArgs.size(), *Diags) && |
| 96 | + !ShouldRecoverOnErorrs) |
103 | 97 | return nullptr;
|
104 | 98 | return CI;
|
105 | 99 | }
|
0 commit comments