diff options
author | Dylan Noblesmith <nobled@dreamwidth.org> | 2011-12-23 03:05:38 +0000 |
---|---|---|
committer | Dylan Noblesmith <nobled@dreamwidth.org> | 2011-12-23 03:05:38 +0000 |
commit | 8fdb6dee2da0dee97d64fe12eda46fb318414de9 (patch) | |
tree | 292fb8930530d2d649998f23dc407d4b5ec0b157 /tools/driver/cc1_main.cpp | |
parent | 9241057266d3460392cbb7fec6ec942d3330ece3 (diff) | |
download | clang-8fdb6dee2da0dee97d64fe12eda46fb318414de9.tar.gz |
Let CompilerInvocation initialization indicate failure
This fixes the FIXMEs in ParseAnalyzeArgs. (Also a
precursor to moving the analyzer into an AST plugin.)
For consistency, do the same with AssemblerInvocation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147218 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/driver/cc1_main.cpp')
-rw-r--r-- | tools/driver/cc1_main.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index f1fb68d539..0a14fdd315 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -77,7 +77,8 @@ static int cc1_test(DiagnosticsEngine &Diags, // Create a compiler invocation. llvm::errs() << "cc1 creating invocation.\n"; CompilerInvocation Invocation; - CompilerInvocation::CreateFromArgs(Invocation, ArgBegin, ArgEnd, Diags); + if (!CompilerInvocation::CreateFromArgs(Invocation, ArgBegin, ArgEnd, Diags)) + return 1; // Convert the invocation back to argument strings. std::vector<std::string> InvocationArgs; @@ -95,8 +96,9 @@ static int cc1_test(DiagnosticsEngine &Diags, // Convert those arguments to another invocation, and check that we got the // same thing. CompilerInvocation Invocation2; - CompilerInvocation::CreateFromArgs(Invocation2, Invocation2Args.begin(), - Invocation2Args.end(), Diags); + if (!CompilerInvocation::CreateFromArgs(Invocation2, Invocation2Args.begin(), + Invocation2Args.end(), Diags)) + return 1; // FIXME: Implement CompilerInvocation comparison. if (true) { @@ -135,8 +137,11 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, // well formed diagnostic object. TextDiagnosticBuffer *DiagsBuffer = new TextDiagnosticBuffer; DiagnosticsEngine Diags(DiagID, DiagsBuffer); - CompilerInvocation::CreateFromArgs(Clang->getInvocation(), ArgBegin, ArgEnd, - Diags); + bool Success; + Success = CompilerInvocation::CreateFromArgs(Clang->getInvocation(), + ArgBegin, ArgEnd, Diags); + if (!Success) + return 1; // Infer the builtin include path if unspecified. if (Clang->getHeaderSearchOpts().UseBuiltinIncludes && @@ -157,7 +162,7 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, DiagsBuffer->FlushDiagnostics(Clang->getDiagnostics()); // Execute the frontend actions. - bool Success = ExecuteCompilerInvocation(Clang.get()); + Success = ExecuteCompilerInvocation(Clang.get()); // If any timers were active but haven't been destroyed yet, print their // results now. This happens in -disable-free mode. |