llvm::OwningPtr to std::unique_ptr.

This commit is contained in:
Vassil Vassilev 2014-08-01 14:02:15 +02:00 committed by sftnight
parent c612a276e9
commit 22f891e9be
9 changed files with 35 additions and 29 deletions

View File

@ -12,11 +12,11 @@
#include "cling/Interpreter/InvocationOptions.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringRef.h"
#include <string>
#include <cstdlib>
#include <memory>
#include <string>
// FIXME: workaround until JIT supports exceptions
#include <setjmp.h>
@ -87,7 +87,7 @@ namespace cling {
class StateDebuggerRAII {
private:
const Interpreter* m_Interpreter;
llvm::OwningPtr<ClangInternalState> m_State;
std::unique_ptr<ClangInternalState> m_State;
public:
StateDebuggerRAII(const Interpreter* i);
~StateDebuggerRAII();
@ -134,19 +134,19 @@ namespace cling {
///\brief The llvm library state, a per-thread object.
///
llvm::OwningPtr<llvm::LLVMContext> m_LLVMContext;
std::unique_ptr<llvm::LLVMContext> m_LLVMContext;
///\brief Cling's execution engine - a well wrapped llvm execution engine.
///
llvm::OwningPtr<IncrementalExecutor> m_Executor;
std::unique_ptr<IncrementalExecutor> m_Executor;
///\brief Cling's worker class implementing the incremental compilation.
///
llvm::OwningPtr<IncrementalParser> m_IncrParser;
std::unique_ptr<IncrementalParser> m_IncrParser;
///\brief Cling's reflection information query.
///
llvm::OwningPtr<LookupHelper> m_LookupHelper;
std::unique_ptr<LookupHelper> m_LookupHelper;
///\brief Counter used when we need unique names.
///
@ -166,11 +166,11 @@ namespace cling {
///\brief Interpreter callbacks.
///
llvm::OwningPtr<InterpreterCallbacks> m_Callbacks;
std::unique_ptr<InterpreterCallbacks> m_Callbacks;
///\brief Dynamic library manager object.
///
llvm::OwningPtr<DynamicLibraryManager> m_DyLibManager;
std::unique_ptr<DynamicLibraryManager> m_DyLibManager;
///\brief Information about the last stored states through .storeState
///

View File

@ -10,10 +10,11 @@
#ifndef CLING_LOOKUP_HELPER_H
#define CLING_LOOKUP_HELPER_H
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/SmallVector.h"
#include <memory>
namespace clang {
class ClassTemplateDecl;
class Decl;
@ -38,7 +39,7 @@ namespace cling {
///
class LookupHelper {
private:
llvm::OwningPtr<clang::Parser> m_Parser;
std::unique_ptr<clang::Parser> m_Parser;
Interpreter* m_Interpreter; // we do not own.
public:

View File

@ -15,10 +15,11 @@
#include "clang/AST/DeclGroup.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include <memory>
namespace clang {
class ASTContext;
class Decl;
@ -123,7 +124,7 @@ namespace cling {
///\brief List of nested transactions if any.
///
llvm::OwningPtr<NestedTransactions> m_NestedTransactions;
std::unique_ptr<NestedTransactions> m_NestedTransactions;
///\brief The enclosing transaction if nested.
///

View File

@ -12,9 +12,10 @@
#include "cling/Interpreter/Interpreter.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/SmallString.h"
#include <memory>
#include <stdio.h>
namespace cling {
@ -36,11 +37,11 @@ namespace cling {
///\brief The input validator is used to figure out whether to switch to
/// multiline mode or not. Checks for balanced parenthesis, etc.
///
llvm::OwningPtr<InputValidator> m_InputValidator;
std::unique_ptr<InputValidator> m_InputValidator;
///\brief The parser used to parse our tiny "meta" language
///
llvm::OwningPtr<MetaParser> m_MetaParser;
std::unique_ptr<MetaParser> m_MetaParser;
///\brief Currently executing file as passed into executeFile
///

View File

@ -10,7 +10,7 @@
#ifndef CLING_USERINTERFACE_H
#define CLING_USERINTERFACE_H
#include "llvm/ADT/OwningPtr.h"
#include <memory>
namespace cling {
class Interpreter;
@ -20,7 +20,7 @@ namespace cling {
///
class UserInterface {
private:
llvm::OwningPtr<MetaProcessor> m_MetaProcessor;
std::unique_ptr<MetaProcessor> m_MetaProcessor;
///\brief Prints cling's startup logo
///

View File

@ -12,12 +12,12 @@
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include <vector>
#include <deque>
#include <memory>
namespace llvm {
struct GenericValue;
@ -55,10 +55,10 @@ namespace cling {
Interpreter* m_Interpreter;
// compiler instance.
llvm::OwningPtr<clang::CompilerInstance> m_CI;
std::unique_ptr<clang::CompilerInstance> m_CI;
// parser (incremental)
llvm::OwningPtr<clang::Parser> m_Parser;
std::unique_ptr<clang::Parser> m_Parser;
// One buffer for each command line, owner by the source file manager
std::deque<llvm::MemoryBuffer*> m_MemoryBuffers;
@ -79,7 +79,7 @@ namespace cling {
///\brief Code generator
///
llvm::OwningPtr<clang::CodeGenerator> m_CodeGen;
std::unique_ptr<clang::CodeGenerator> m_CodeGen;
///\brief Contains the transaction AST transformers.
///
@ -91,7 +91,7 @@ namespace cling {
///\brief Pool of reusable block-allocated transactions.
///
llvm::OwningPtr<TransactionPool> m_TransactionPool;
std::unique_ptr<TransactionPool> m_TransactionPool;
public:
enum EParseResult {

View File

@ -425,7 +425,7 @@ namespace cling {
// the results in pipes (Savannah #99234).
// Alternatively we could use llvm::errs()
llvm::OwningPtr<llvm::raw_ostream> Out;
std::unique_ptr<llvm::raw_ostream> Out;
Out.reset(new llvm::raw_os_ostream(std::cout));
print(*Out.get());
}

View File

@ -12,9 +12,10 @@
#include "MetaLexer.h" // for cling::Token
#include "MetaSema.h" // for ActionResult
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallVector.h"
#include <memory>
namespace llvm {
class StringRef;
}
@ -61,8 +62,8 @@ namespace cling {
//
class MetaParser {
private:
llvm::OwningPtr<MetaLexer> m_Lexer;
llvm::OwningPtr<MetaSema> m_Actions;
std::unique_ptr<MetaLexer> m_Lexer;
std::unique_ptr<MetaSema> m_Actions;
llvm::SmallVector<Token, 2> m_TokenCache;
llvm::SmallVector<Token, 4> m_MetaSymbolCache;
private:

View File

@ -43,6 +43,8 @@
#endif
#endif
#include <memory>
namespace {
// Handle fatal llvm errors by throwing an exception.
// Yes, throwing exceptions in error handlers is bad.
@ -109,8 +111,8 @@ namespace cling {
}
using namespace textinput;
llvm::OwningPtr<StreamReader> R(StreamReader::Create());
llvm::OwningPtr<TerminalDisplay> D(TerminalDisplay::Create());
std::unique_ptr<StreamReader> R(StreamReader::Create());
std::unique_ptr<TerminalDisplay> D(TerminalDisplay::Create());
TextInput TI(*R, *D, histfilePath.empty() ? 0 : histfilePath.c_str());
TI.SetPrompt("[cling]$ ");