From dbe13110f59f48b4dbb7552b3ac2935acdeece7f Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 14 Apr 2012 14:01:31 +0000 Subject: Vendor import of clang trunk r154661: http://llvm.org/svn/llvm-project/cfe/trunk@r154661 --- lib/Frontend/CreateInvocationFromCommandLine.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib/Frontend/CreateInvocationFromCommandLine.cpp') 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 ArgList, - llvm::IntrusiveRefCntPtr Diags) { + IntrusiveRefCntPtr 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 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 C(TheDriver.BuildCompilation(Args)); + OwningPtr 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 ArgList, // failed. const driver::JobList &Jobs = C->getJobs(); if (Jobs.size() != 1 || !isa(*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 ArgList, } const driver::ArgStringList &CCArgs = Cmd->getArguments(); - CompilerInvocation *CI = new CompilerInvocation(); - CompilerInvocation::CreateFromArgs(*CI, + 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