summaryrefslogtreecommitdiffstats
path: root/clang/tools/driver/cc1_main.cpp
diff options
context:
space:
mode:
authorDylan Noblesmith <nobled@dreamwidth.org>2011-12-23 03:05:38 +0000
committerDylan Noblesmith <nobled@dreamwidth.org>2011-12-23 03:05:38 +0000
commite99b27f35e802bb3b7ef40068e75f8fb3378c103 (patch)
tree284f9f683aba5f63f5fbc5875a8e8d42981a0c48 /clang/tools/driver/cc1_main.cpp
parent5d44a4332a7cc34dbbf91df28fe150e605fb89d7 (diff)
downloadbcm5719-llvm-e99b27f35e802bb3b7ef40068e75f8fb3378c103.tar.gz
bcm5719-llvm-e99b27f35e802bb3b7ef40068e75f8fb3378c103.zip
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. llvm-svn: 147218
Diffstat (limited to 'clang/tools/driver/cc1_main.cpp')
-rw-r--r--clang/tools/driver/cc1_main.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/clang/tools/driver/cc1_main.cpp b/clang/tools/driver/cc1_main.cpp
index f1fb68d539b..0a14fdd315d 100644
--- a/clang/tools/driver/cc1_main.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud