diff options
Diffstat (limited to 'lib/Frontend/CreateInvocationFromCommandLine.cpp')
| -rw-r--r-- | lib/Frontend/CreateInvocationFromCommandLine.cpp | 17 | 
1 files changed, 9 insertions, 8 deletions
| diff --git a/lib/Frontend/CreateInvocationFromCommandLine.cpp b/lib/Frontend/CreateInvocationFromCommandLine.cpp index fc1508103c2e..b477adebaddc 100644 --- a/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -30,7 +30,7 @@ using namespace clang;  /// argument vector.  CompilerInvocation *  clang::createInvocationFromCommandLine(ArrayRef<const char *> ArgList, -                            llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags) { +                            IntrusiveRefCntPtr<DiagnosticsEngine> Diags) {    if (!Diags.getPtr()) {      // No diagnostics engine was provided, so create our own diagnostics object      // with the default options. @@ -48,13 +48,13 @@ clang::createInvocationFromCommandLine(ArrayRef<const char *> ArgList,    Args.push_back("-fsyntax-only");    // FIXME: We shouldn't have to pass in the path info. -  driver::Driver TheDriver("clang", llvm::sys::getHostTriple(), +  driver::Driver TheDriver("clang", llvm::sys::getDefaultTargetTriple(),                             "a.out", false, *Diags);    // Don't check that inputs exist, they may have been remapped.    TheDriver.setCheckInputsExist(false); -  llvm::OwningPtr<driver::Compilation> C(TheDriver.BuildCompilation(Args)); +  OwningPtr<driver::Compilation> C(TheDriver.BuildCompilation(Args));    // Just print the cc1 options if -### was present.    if (C->getArgs().hasArg(driver::options::OPT__HASH_HASH_HASH)) { @@ -66,7 +66,7 @@ clang::createInvocationFromCommandLine(ArrayRef<const char *> ArgList,    // failed.    const driver::JobList &Jobs = C->getJobs();    if (Jobs.size() != 1 || !isa<driver::Command>(*Jobs.begin())) { -    llvm::SmallString<256> Msg; +    SmallString<256> Msg;      llvm::raw_svector_ostream OS(Msg);      C->PrintJob(OS, C->getJobs(), "; ", true);      Diags->Report(diag::err_fe_expected_compiler_job) << OS.str(); @@ -80,11 +80,12 @@ clang::createInvocationFromCommandLine(ArrayRef<const char *> ArgList,    }    const driver::ArgStringList &CCArgs = Cmd->getArguments(); -  CompilerInvocation *CI = new CompilerInvocation(); -  CompilerInvocation::CreateFromArgs(*CI, +  OwningPtr<CompilerInvocation> CI(new CompilerInvocation()); +  if (!CompilerInvocation::CreateFromArgs(*CI,                                       const_cast<const char **>(CCArgs.data()),                                       const_cast<const char **>(CCArgs.data()) +                                       CCArgs.size(), -                                     *Diags); -  return CI; +                                     *Diags)) +    return 0; +  return CI.take();  } | 
