llvm::OwningPtr is now std::unique_ptr.

This commit is contained in:
Vassil Vassilev 2014-08-14 12:29:27 +02:00 committed by sftnight
parent 7d8b4d55ec
commit 0aa2a31fa0
11 changed files with 36 additions and 37 deletions

View File

@ -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)) \

View File

@ -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 <memory>
#include <string>
namespace clang {
@ -49,7 +49,7 @@ namespace cling {
std::string m_Name;
///\brief Takes the ownership after compare was made.
///
llvm::OwningPtr<ClangInternalState> m_DiffPair;
std::unique_ptr<ClangInternalState> m_DiffPair;
public:
ClangInternalState(clang::ASTContext& AC, clang::Preprocessor& PP,
llvm::Module* M, clang::CodeGenerator* CG,

View File

@ -12,7 +12,7 @@
#include "TransactionTransformer.h"
#include "llvm/ADT/OwningPtr.h"
#include <memory>
namespace clang {
class Sema;
@ -27,7 +27,7 @@ namespace cling {
class AutoSynthesizer : public TransactionTransformer {
private:
llvm::OwningPtr<AutoFixer> m_AutoFixer;
std::unique_ptr<AutoFixer> m_AutoFixer;
public:
///\ brief Constructs the auto synthesizer.

View File

@ -10,10 +10,10 @@
#ifndef CLING_TRANSACTION_BACKENDPASS_H
#define CLING_TRANSACTION_BACKENDPASS_H
#include "llvm/ADT/OwningPtr.h"
#include "TransactionTransformer.h"
#include <memory>
namespace clang {
class CodeGenOptions;
class DiagnosticsEngine;
@ -39,9 +39,9 @@ namespace cling {
/// no PerModulePasses.
class BackendPass: public TransactionTransformer {
llvm::Module* m_Module;
llvm::OwningPtr<llvm::FunctionPassManager> m_PerFunctionPasses;
llvm::OwningPtr<llvm::PassManager> m_PerModulePasses;
llvm::OwningPtr<llvm::TargetMachine> m_TM;
std::unique_ptr<llvm::FunctionPassManager> m_PerFunctionPasses;
std::unique_ptr<llvm::PassManager> m_PerModulePasses;
std::unique_ptr<llvm::TargetMachine> m_TM;
public:
///\brief Initializes the backend pass adaptor.

View File

@ -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 <ctime>
#include <cstdio>
#include <memory>
// 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::ArrayRef<const char*>RF(&(argvCompile[0]), argvCompile.size());
llvm::OwningPtr<clang::driver::Compilation>
std::unique_ptr<clang::driver::Compilation>
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<CompilerInstance> CI(new CompilerInstance());
std::unique_ptr<CompilerInstance> 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) {

View File

@ -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<llvm::raw_fd_ostream> m_LookupTablesOS;
llvm::OwningPtr<llvm::raw_fd_ostream> m_IncludedFilesOS;
llvm::OwningPtr<llvm::raw_fd_ostream> m_ASTOS;
llvm::OwningPtr<llvm::raw_fd_ostream> m_LLVMModuleOS;
llvm::OwningPtr<llvm::raw_fd_ostream> m_MacrosOS;
std::unique_ptr<llvm::raw_fd_ostream> m_LookupTablesOS;
std::unique_ptr<llvm::raw_fd_ostream> m_IncludedFilesOS;
std::unique_ptr<llvm::raw_fd_ostream> m_ASTOS;
std::unique_ptr<llvm::raw_fd_ostream> m_LLVMModuleOS;
std::unique_ptr<llvm::raw_fd_ostream> 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<llvm::raw_fd_ostream> OS;
std::unique_ptr<llvm::raw_fd_ostream> 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) {

View File

@ -15,7 +15,6 @@
#include "clang/AST/StmtVisitor.h"
#include "clang/Sema/Ownership.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/Support/Casting.h"

View File

@ -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 <vector>
#include <set>
#include <map>
#include <memory>
namespace clang {
class DiagnosticsEngine;
@ -48,7 +48,7 @@ namespace cling {
///\brief The llvm ExecutionEngine.
///
llvm::OwningPtr<llvm::ExecutionEngine> m_engine;
std::unique_ptr<llvm::ExecutionEngine> m_engine;
///\brief Symbols to be replaced by special Interpreter implementations.
///

View File

@ -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 <memory>
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<OptTable> OptsC1(clang::driver::createDriverOptTable());
std::unique_ptr<OptTable> OptsC1(clang::driver::createDriverOptTable());
Opts.Inputs.clear();
llvm::OwningPtr<InputArgList> Args(
std::unique_ptr<InputArgList> 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<unsigned>& leftoverArgs
/* , Diagnostic &Diags */) {
InvocationOptions ClingOpts;
llvm::OwningPtr<OptTable> Opts(CreateClingOptTable());
std::unique_ptr<OptTable> Opts(CreateClingOptTable());
unsigned MissingArgIndex, MissingArgCount;
llvm::OwningPtr<InputArgList> Args(
std::unique_ptr<InputArgList> 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<OptTable> Opts(CreateClingOptTable());
std::unique_ptr<OptTable> Opts(CreateClingOptTable());
Opts->PrintHelp(llvm::outs(), "cling",
"cling: LLVM/clang C++ Interpreter: http://cern.ch/cling");
llvm::outs() << "\n\n";
llvm::OwningPtr<OptTable> OptsC1(clang::driver::createDriverOptTable());
std::unique_ptr<OptTable> OptsC1(clang::driver::createDriverOptTable());
OptsC1->PrintHelp(llvm::outs(), "clang -cc1",
"LLVM 'Clang' Compiler: http://clang.llvm.org");

View File

@ -12,7 +12,7 @@
#include "TransactionTransformer.h"
#include "llvm/ADT/OwningPtr.h"
#include <memory>
namespace clang {
class ASTContext;
@ -37,7 +37,7 @@ namespace cling {
///\brief Stream to dump values into.
///
llvm::OwningPtr<llvm::raw_ostream> m_ValuePrinterStream;
std::unique_ptr<llvm::raw_ostream> m_ValuePrinterStream;
public:
///\ brief Constructs the value printer synthesizer.

View File

@ -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 <memory>
#include <stdio.h>
using namespace clang;
@ -54,7 +54,7 @@ namespace utils {
NamedDecl* D
= cast<NamedDecl>(const_cast<Decl*>(GD.getDecl()));
llvm::OwningPtr<MangleContext> mangleCtx;
std::unique_ptr<MangleContext> mangleCtx;
mangleCtx.reset(D->getASTContext().createMangleContext());
if (!mangleCtx->shouldMangleDeclName(D)) {
IdentifierInfo *II = D->getIdentifier();