From 0aa2a31fa0a7416610b3f10db6a4d203a11f3f39 Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Thu, 14 Aug 2014 12:29:27 +0200 Subject: [PATCH] llvm::OwningPtr is now std::unique_ptr. --- Module.mk | 2 -- include/cling/Interpreter/ClangInternalState.h | 4 ++-- lib/Interpreter/AutoSynthesizer.h | 4 ++-- lib/Interpreter/BackendPass.h | 10 +++++----- lib/Interpreter/CIFactory.cpp | 9 +++++---- lib/Interpreter/ClangInternalState.cpp | 16 ++++++++-------- lib/Interpreter/DynamicLookup.h | 1 - lib/Interpreter/IncrementalExecutor.h | 4 ++-- lib/Interpreter/InvocationOptions.cpp | 15 ++++++++------- lib/Interpreter/ValuePrinterSynthesizer.h | 4 ++-- lib/Utils/AST.cpp | 4 ++-- 11 files changed, 36 insertions(+), 37 deletions(-) diff --git a/Module.mk b/Module.mk index 13b47a00..ab1536df 100644 --- a/Module.mk +++ b/Module.mk @@ -24,7 +24,6 @@ CLINGETC_CLING := DynamicExprInfo.h DynamicLookupRuntimeUniverse.h \ RuntimeUniverse.h Value.h RuntimeException.h CLINGETC_LLVM := llvm/ADT/IntrusiveRefCntPtr.h \ - llvm/ADT/OwningPtr.h \ llvm/ADT/StringRef.h \ llvm/ADT/SmallVector.h \ llvm/ADT/iterator_range.h \ @@ -37,7 +36,6 @@ CLINGETC_LLVM := llvm/ADT/IntrusiveRefCntPtr.h \ llvm/Support/MathExtras.h \ llvm/Support/Memory.h \ llvm/Support/SwapByteOrder.h \ - llvm/Support/system_error.h \ llvm/Support/type_traits.h CLINGETCPCH := $(addprefix etc/cling/Interpreter/,$(CLINGETC_CLING)) \ diff --git a/include/cling/Interpreter/ClangInternalState.h b/include/cling/Interpreter/ClangInternalState.h index 2f9c74cf..327eccec 100644 --- a/include/cling/Interpreter/ClangInternalState.h +++ b/include/cling/Interpreter/ClangInternalState.h @@ -10,10 +10,10 @@ #ifndef CLING_CLANG_INTERNAL_STATE_H #define CLING_CLANG_INTERNAL_STATE_H -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" +#include #include namespace clang { @@ -49,7 +49,7 @@ namespace cling { std::string m_Name; ///\brief Takes the ownership after compare was made. /// - llvm::OwningPtr m_DiffPair; + std::unique_ptr m_DiffPair; public: ClangInternalState(clang::ASTContext& AC, clang::Preprocessor& PP, llvm::Module* M, clang::CodeGenerator* CG, diff --git a/lib/Interpreter/AutoSynthesizer.h b/lib/Interpreter/AutoSynthesizer.h index fa51e36b..feeab162 100644 --- a/lib/Interpreter/AutoSynthesizer.h +++ b/lib/Interpreter/AutoSynthesizer.h @@ -12,7 +12,7 @@ #include "TransactionTransformer.h" -#include "llvm/ADT/OwningPtr.h" +#include namespace clang { class Sema; @@ -27,7 +27,7 @@ namespace cling { class AutoSynthesizer : public TransactionTransformer { private: - llvm::OwningPtr m_AutoFixer; + std::unique_ptr m_AutoFixer; public: ///\ brief Constructs the auto synthesizer. diff --git a/lib/Interpreter/BackendPass.h b/lib/Interpreter/BackendPass.h index 96eeed4c..61113508 100644 --- a/lib/Interpreter/BackendPass.h +++ b/lib/Interpreter/BackendPass.h @@ -10,10 +10,10 @@ #ifndef CLING_TRANSACTION_BACKENDPASS_H #define CLING_TRANSACTION_BACKENDPASS_H -#include "llvm/ADT/OwningPtr.h" - #include "TransactionTransformer.h" +#include + namespace clang { class CodeGenOptions; class DiagnosticsEngine; @@ -39,9 +39,9 @@ namespace cling { /// no PerModulePasses. class BackendPass: public TransactionTransformer { llvm::Module* m_Module; - llvm::OwningPtr m_PerFunctionPasses; - llvm::OwningPtr m_PerModulePasses; - llvm::OwningPtr m_TM; + std::unique_ptr m_PerFunctionPasses; + std::unique_ptr m_PerModulePasses; + std::unique_ptr m_TM; public: ///\brief Initializes the backend pass adaptor. diff --git a/lib/Interpreter/CIFactory.cpp b/lib/Interpreter/CIFactory.cpp index b21ed2f5..66306b6c 100644 --- a/lib/Interpreter/CIFactory.cpp +++ b/lib/Interpreter/CIFactory.cpp @@ -25,7 +25,6 @@ #include "clang/Sema/Sema.h" #include "clang/Sema/SemaDiagnostic.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/Config/config.h" #include "llvm/IR/LLVMContext.h" #include "llvm/Option/ArgList.h" @@ -39,6 +38,8 @@ #include #include +#include + // Include the necessary headers to interface with the Windows registry and // environment. #ifdef _MSC_VER @@ -588,7 +589,7 @@ namespace cling { //Driver.setWarnMissingInput(false); Driver.setCheckInputsExist(false); // think foo.C(12) llvm::ArrayRefRF(&(argvCompile[0]), argvCompile.size()); - llvm::OwningPtr + std::unique_ptr Compilation(Driver.BuildCompilation(RF)); const clang::driver::ArgStringList* CC1Args = GetCC1Arguments(Diags.get(), Compilation.get()); @@ -631,7 +632,7 @@ namespace cling { } // Create and setup a compiler instance. - llvm::OwningPtr CI(new CompilerInstance()); + std::unique_ptr CI(new CompilerInstance()); CI->setInvocation(Invocation); CI->setDiagnostics(Diags.get()); { @@ -739,7 +740,7 @@ namespace cling { // the JIT to crash CI->getCodeGenOpts().VerifyModule = 0; // takes too long - return CI.take(); // Passes over the ownership to the caller. + return CI.release(); // Passes over the ownership to the caller. } void CIFactory::SetClingCustomLangOpts(LangOptions& Opts) { diff --git a/lib/Interpreter/ClangInternalState.cpp b/lib/Interpreter/ClangInternalState.cpp index 6748804a..8853c8da 100644 --- a/lib/Interpreter/ClangInternalState.cpp +++ b/lib/Interpreter/ClangInternalState.cpp @@ -41,7 +41,7 @@ namespace cling { llvm::Module* M, CodeGenerator* CG, const std::string& name) : m_ASTContext(AC), m_Preprocessor(PP), m_CodeGen(CG), m_Module(M), - m_DiffCommand("diff -u --text "), m_Name(name), m_DiffPair(0) { + m_DiffCommand("diff -u --text "), m_Name(name), m_DiffPair(nullptr) { store(); } @@ -56,11 +56,11 @@ namespace cling { void ClangInternalState::store() { // Cannot use the stack (private copy ctor) - llvm::OwningPtr m_LookupTablesOS; - llvm::OwningPtr m_IncludedFilesOS; - llvm::OwningPtr m_ASTOS; - llvm::OwningPtr m_LLVMModuleOS; - llvm::OwningPtr m_MacrosOS; + std::unique_ptr m_LookupTablesOS; + std::unique_ptr m_IncludedFilesOS; + std::unique_ptr m_ASTOS; + std::unique_ptr m_LLVMModuleOS; + std::unique_ptr m_MacrosOS; m_LookupTablesOS.reset(createOutputFile("lookup", &m_LookupTablesFile)); @@ -97,7 +97,7 @@ namespace cling { ClangInternalState::createOutputFile(llvm::StringRef OutFile, std::string *TempPathName/*=0*/, bool RemoveFileOnSignal/*=true*/) { - llvm::OwningPtr OS; + std::unique_ptr OS; std::string OSFile; llvm::SmallString<256> OutputPath; llvm::sys::path::system_temp_directory(/*erasedOnReboot*/false, OutputPath); @@ -126,7 +126,7 @@ namespace cling { if (TempPathName) *TempPathName = OSFile; - return OS.take(); + return OS.release(); } void ClangInternalState::compare(const std::string& name) { diff --git a/lib/Interpreter/DynamicLookup.h b/lib/Interpreter/DynamicLookup.h index 0a32b06b..484c5699 100644 --- a/lib/Interpreter/DynamicLookup.h +++ b/lib/Interpreter/DynamicLookup.h @@ -15,7 +15,6 @@ #include "clang/AST/StmtVisitor.h" #include "clang/Sema/Ownership.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/Support/Casting.h" diff --git a/lib/Interpreter/IncrementalExecutor.h b/lib/Interpreter/IncrementalExecutor.h index 968f6420..c2352e86 100644 --- a/lib/Interpreter/IncrementalExecutor.h +++ b/lib/Interpreter/IncrementalExecutor.h @@ -10,13 +10,13 @@ #ifndef CLING_INCREMENTAL_EXECUTOR_H #define CLING_INCREMENTAL_EXECUTOR_H -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include #include #include +#include namespace clang { class DiagnosticsEngine; @@ -48,7 +48,7 @@ namespace cling { ///\brief The llvm ExecutionEngine. /// - llvm::OwningPtr m_engine; + std::unique_ptr m_engine; ///\brief Symbols to be replaced by special Interpreter implementations. /// diff --git a/lib/Interpreter/InvocationOptions.cpp b/lib/Interpreter/InvocationOptions.cpp index d5436649..f3b90283 100644 --- a/lib/Interpreter/InvocationOptions.cpp +++ b/lib/Interpreter/InvocationOptions.cpp @@ -12,13 +12,14 @@ #include "clang/Driver/Options.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/Option/Arg.h" #include "llvm/Option/ArgList.h" #include "llvm/Option/Option.h" #include "llvm/Option/OptTable.h" #include "llvm/Support/raw_ostream.h" +#include + using namespace clang; using namespace cling::driver::clingoptions; @@ -85,9 +86,9 @@ namespace { int argc, const char* const argv[]) { if (argc <= 1) { return; } unsigned MissingArgIndex, MissingArgCount; - llvm::OwningPtr OptsC1(clang::driver::createDriverOptTable()); + std::unique_ptr OptsC1(clang::driver::createDriverOptTable()); Opts.Inputs.clear(); - llvm::OwningPtr Args( + std::unique_ptr Args( OptsC1->ParseArgs(argv+1, argv + argc, MissingArgIndex, MissingArgCount)); for (ArgList::const_iterator it = Args->begin(), ie = Args->end(); it != ie; ++it) { @@ -103,9 +104,9 @@ cling::InvocationOptions::CreateFromArgs(int argc, const char* const argv[], std::vector& leftoverArgs /* , Diagnostic &Diags */) { InvocationOptions ClingOpts; - llvm::OwningPtr Opts(CreateClingOptTable()); + std::unique_ptr Opts(CreateClingOptTable()); unsigned MissingArgIndex, MissingArgCount; - llvm::OwningPtr Args( + std::unique_ptr Args( Opts->ParseArgs(argv, argv + argc, MissingArgIndex, MissingArgCount)); //if (MissingArgCount) @@ -127,14 +128,14 @@ cling::InvocationOptions::CreateFromArgs(int argc, const char* const argv[], } void cling::InvocationOptions::PrintHelp() { - llvm::OwningPtr Opts(CreateClingOptTable()); + std::unique_ptr Opts(CreateClingOptTable()); Opts->PrintHelp(llvm::outs(), "cling", "cling: LLVM/clang C++ Interpreter: http://cern.ch/cling"); llvm::outs() << "\n\n"; - llvm::OwningPtr OptsC1(clang::driver::createDriverOptTable()); + std::unique_ptr OptsC1(clang::driver::createDriverOptTable()); OptsC1->PrintHelp(llvm::outs(), "clang -cc1", "LLVM 'Clang' Compiler: http://clang.llvm.org"); diff --git a/lib/Interpreter/ValuePrinterSynthesizer.h b/lib/Interpreter/ValuePrinterSynthesizer.h index fa98ed6e..07dd0ec6 100644 --- a/lib/Interpreter/ValuePrinterSynthesizer.h +++ b/lib/Interpreter/ValuePrinterSynthesizer.h @@ -12,7 +12,7 @@ #include "TransactionTransformer.h" -#include "llvm/ADT/OwningPtr.h" +#include namespace clang { class ASTContext; @@ -37,7 +37,7 @@ namespace cling { ///\brief Stream to dump values into. /// - llvm::OwningPtr m_ValuePrinterStream; + std::unique_ptr m_ValuePrinterStream; public: ///\ brief Constructs the value printer synthesizer. diff --git a/lib/Utils/AST.cpp b/lib/Utils/AST.cpp index c7bbec03..e89673dd 100644 --- a/lib/Utils/AST.cpp +++ b/lib/Utils/AST.cpp @@ -17,10 +17,10 @@ #include "clang/AST/DeclTemplate.h" #include "llvm/ADT/ArrayRef.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/StringRef.h" #include "clang/AST/Mangle.h" +#include #include using namespace clang; @@ -54,7 +54,7 @@ namespace utils { NamedDecl* D = cast(const_cast(GD.getDecl())); - llvm::OwningPtr mangleCtx; + std::unique_ptr mangleCtx; mangleCtx.reset(D->getASTContext().createMangleContext()); if (!mangleCtx->shouldMangleDeclName(D)) { IdentifierInfo *II = D->getIdentifier();