From 9f4dbff6669c8037f3b036bcf580d14f1a4f12a5 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 24 Nov 2014 09:15:30 +0000 Subject: Vendor import of clang RELEASE_350/final tag r216957 (effectively, 3.5.0 release): https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_350/final@216957 --- examples/clang-interpreter/main.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'examples/clang-interpreter/main.cpp') diff --git a/examples/clang-interpreter/main.cpp b/examples/clang-interpreter/main.cpp index e00583d1a1ab..8b8ccfdf70a0 100644 --- a/examples/clang-interpreter/main.cpp +++ b/examples/clang-interpreter/main.cpp @@ -16,7 +16,6 @@ #include "clang/Frontend/CompilerInvocation.h" #include "clang/Frontend/FrontendDiagnostic.h" #include "clang/Frontend/TextDiagnosticPrinter.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallString.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/ExecutionEngine/JIT.h" @@ -27,6 +26,7 @@ #include "llvm/Support/Path.h" #include "llvm/Support/TargetSelect.h" #include "llvm/Support/raw_ostream.h" +#include using namespace clang; using namespace clang::driver; @@ -46,8 +46,8 @@ static int Execute(llvm::Module *Mod, char * const *envp) { llvm::InitializeNativeTarget(); std::string Error; - OwningPtr EE( - llvm::ExecutionEngine::createJIT(Mod, &Error)); + std::unique_ptr EE( + llvm::ExecutionEngine::create(Mod, /*ForceInterpreter*/ false, &Error)); if (!EE) { llvm::errs() << "unable to make execution engine: " << Error << "\n"; return 255; @@ -75,15 +75,16 @@ int main(int argc, const char **argv, char * const *envp) { IntrusiveRefCntPtr DiagID(new DiagnosticIDs()); DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagClient); - Driver TheDriver(Path, llvm::sys::getProcessTriple(), "a.out", Diags); + Driver TheDriver(Path, llvm::sys::getProcessTriple(), Diags); TheDriver.setTitle("clang interpreter"); + TheDriver.setCheckInputsExist(false); // FIXME: This is a hack to try to force the driver to do something we can // recognize. We need to extend the driver library to support this use model // (basically, exactly one input, and the operation mode is hard wired). SmallVector Args(argv, argv + argc); Args.push_back("-fsyntax-only"); - OwningPtr C(TheDriver.BuildCompilation(Args)); + std::unique_ptr C(TheDriver.BuildCompilation(Args)); if (!C) return 0; @@ -108,7 +109,7 @@ int main(int argc, const char **argv, char * const *envp) { // Initialize a compiler invocation object from the clang (-cc1) arguments. const driver::ArgStringList &CCArgs = Cmd->getArguments(); - OwningPtr CI(new CompilerInvocation); + std::unique_ptr CI(new CompilerInvocation); CompilerInvocation::CreateFromArgs(*CI, const_cast(CCArgs.data()), const_cast(CCArgs.data()) + @@ -126,7 +127,7 @@ int main(int argc, const char **argv, char * const *envp) { // Create a compiler instance to handle the actual work. CompilerInstance Clang; - Clang.setInvocation(CI.take()); + Clang.setInvocation(CI.release()); // Create the compilers actual diagnostics engine. Clang.createDiagnostics(); @@ -140,7 +141,7 @@ int main(int argc, const char **argv, char * const *envp) { CompilerInvocation::GetResourcesPath(argv[0], MainAddr); // Create and execute the frontend to generate an LLVM bitcode module. - OwningPtr Act(new EmitLLVMOnlyAction()); + std::unique_ptr Act(new EmitLLVMOnlyAction()); if (!Clang.ExecuteAction(*Act)) return 1; -- cgit v1.2.3