From 8fdb6dee2da0dee97d64fe12eda46fb318414de9 Mon Sep 17 00:00:00 2001 From: Dylan Noblesmith Date: Fri, 23 Dec 2011 03:05:38 +0000 Subject: 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 --- lib/Frontend/CreateInvocationFromCommandLine.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/Frontend/CreateInvocationFromCommandLine.cpp') diff --git a/lib/Frontend/CreateInvocationFromCommandLine.cpp b/lib/Frontend/CreateInvocationFromCommandLine.cpp index e94b944f04..f7a296143f 100644 --- a/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -80,11 +80,12 @@ clang::createInvocationFromCommandLine(ArrayRef ArgList, } const driver::ArgStringList &CCArgs = Cmd->getArguments(); - CompilerInvocation *CI = new CompilerInvocation(); - CompilerInvocation::CreateFromArgs(*CI, + llvm::OwningPtr CI(new CompilerInvocation()); + if (!CompilerInvocation::CreateFromArgs(*CI, const_cast(CCArgs.data()), const_cast(CCArgs.data()) + CCArgs.size(), - *Diags); - return CI; + *Diags)) + return 0; + return CI.take(); } -- cgit v1.2.3