summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorAhmed Charles <ahmedcharles@gmail.com>2014-03-06 05:51:42 +0000
committerAhmed Charles <ahmedcharles@gmail.com>2014-03-06 05:51:42 +0000
commitf4ccd110750a3f3fe6a107d5c74c649c2a0dc407 (patch)
treeded9f38d17d1d9f3693d90f82a0a596726034174 /include/llvm
parentca8b562f2d4d996d5198af537ad312e544da1172 (diff)
downloadllvm-f4ccd110750a3f3fe6a107d5c74c649c2a0dc407.tar.gz
llvm-f4ccd110750a3f3fe6a107d5c74c649c2a0dc407.tar.bz2
llvm-f4ccd110750a3f3fe6a107d5c74c649c2a0dc407.tar.xz
Replace OwningPtr<T> with std::unique_ptr<T>.
This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Analysis/CallGraph.h3
-rw-r--r--include/llvm/Analysis/MemoryDependenceAnalysis.h4
-rw-r--r--include/llvm/Bitcode/BitstreamReader.h3
-rw-r--r--include/llvm/CodeGen/RegAllocPBQP.h6
-rw-r--r--include/llvm/ExecutionEngine/ObjectBuffer.h3
-rw-r--r--include/llvm/ExecutionEngine/ObjectImage.h2
-rw-r--r--include/llvm/IR/Module.h4
-rw-r--r--include/llvm/LTO/LTOModule.h5
-rw-r--r--include/llvm/LineEditor/LineEditor.h4
-rw-r--r--include/llvm/MC/MCDisassembler.h11
-rw-r--r--include/llvm/MC/MCExternalSymbolizer.h10
-rw-r--r--include/llvm/MC/MCMachObjectWriter.h3
-rw-r--r--include/llvm/MC/MCModuleYAML.h3
-rw-r--r--include/llvm/MC/MCObjectDisassembler.h5
-rw-r--r--include/llvm/MC/MCObjectSymbolizer.h7
-rw-r--r--include/llvm/MC/MCStreamer.h4
-rw-r--r--include/llvm/MC/MCSymbolizer.h6
-rw-r--r--include/llvm/Object/IRObjectFile.h5
-rw-r--r--include/llvm/Object/MachOUniversal.h5
-rw-r--r--include/llvm/Support/Compression.h6
-rw-r--r--include/llvm/Support/FileSystem.h1
-rw-r--r--include/llvm/Support/StreamableMemoryObject.h5
-rw-r--r--include/llvm/Support/YAMLParser.h36
-rw-r--r--include/llvm/Support/YAMLTraits.h18
24 files changed, 73 insertions, 86 deletions
diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h
index d46cbb60cd..9a6a4a76eb 100644
--- a/include/llvm/Analysis/CallGraph.h
+++ b/include/llvm/Analysis/CallGraph.h
@@ -53,7 +53,6 @@
#define LLVM_ANALYSIS_CALLGRAPH_H
#include "llvm/ADT/GraphTraits.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Function.h"
@@ -314,7 +313,7 @@ private:
/// call graph interface is entirelly a wrapper around a \c CallGraph object
/// which is stored internally for each module.
class CallGraphWrapperPass : public ModulePass {
- OwningPtr<CallGraph> G;
+ std::unique_ptr<CallGraph> G;
public:
static char ID; // Class identification, replacement for typeinfo
diff --git a/include/llvm/Analysis/MemoryDependenceAnalysis.h b/include/llvm/Analysis/MemoryDependenceAnalysis.h
index 79945612f8..123d435a6e 100644
--- a/include/llvm/Analysis/MemoryDependenceAnalysis.h
+++ b/include/llvm/Analysis/MemoryDependenceAnalysis.h
@@ -15,7 +15,6 @@
#define LLVM_ANALYSIS_MEMORYDEPENDENCEANALYSIS_H
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Analysis/AliasAnalysis.h"
@@ -325,7 +324,8 @@ namespace llvm {
AliasAnalysis *AA;
const DataLayout *DL;
DominatorTree *DT;
- OwningPtr<PredIteratorCache> PredCache;
+ std::unique_ptr<PredIteratorCache> PredCache;
+
public:
MemoryDependenceAnalysis();
~MemoryDependenceAnalysis();
diff --git a/include/llvm/Bitcode/BitstreamReader.h b/include/llvm/Bitcode/BitstreamReader.h
index dc5e095155..fcbf426044 100644
--- a/include/llvm/Bitcode/BitstreamReader.h
+++ b/include/llvm/Bitcode/BitstreamReader.h
@@ -15,7 +15,6 @@
#ifndef LLVM_BITCODE_BITSTREAMREADER_H
#define LLVM_BITCODE_BITSTREAMREADER_H
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/Bitcode/BitCodes.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/StreamableMemoryObject.h"
@@ -44,7 +43,7 @@ public:
std::vector<std::pair<unsigned, std::string> > RecordNames;
};
private:
- OwningPtr<StreamableMemoryObject> BitcodeBytes;
+ std::unique_ptr<StreamableMemoryObject> BitcodeBytes;
std::vector<BlockInfo> BlockInfoRecords;
diff --git a/include/llvm/CodeGen/RegAllocPBQP.h b/include/llvm/CodeGen/RegAllocPBQP.h
index 40539dcab2..4b0e0bd6ff 100644
--- a/include/llvm/CodeGen/RegAllocPBQP.h
+++ b/include/llvm/CodeGen/RegAllocPBQP.h
@@ -29,7 +29,6 @@ namespace llvm {
class MachineBlockFrequencyInfo;
class MachineFunction;
class TargetRegisterInfo;
- template<class T> class OwningPtr;
typedef PBQP::RegAlloc::Graph PBQPRAGraph;
@@ -158,8 +157,9 @@ namespace llvm {
PBQP::PBQPNum benefit);
};
- FunctionPass* createPBQPRegisterAllocator(OwningPtr<PBQPBuilder> &builder,
- char *customPassID=0);
+ FunctionPass *
+ createPBQPRegisterAllocator(std::unique_ptr<PBQPBuilder> &builder,
+ char *customPassID = 0);
}
#endif /* LLVM_CODEGEN_REGALLOCPBQP_H */
diff --git a/include/llvm/ExecutionEngine/ObjectBuffer.h b/include/llvm/ExecutionEngine/ObjectBuffer.h
index af2a9263ff..f6736d1686 100644
--- a/include/llvm/ExecutionEngine/ObjectBuffer.h
+++ b/include/llvm/ExecutionEngine/ObjectBuffer.h
@@ -15,7 +15,6 @@
#ifndef LLVM_EXECUTIONENGINE_OBJECTBUFFER_H
#define LLVM_EXECUTIONENGINE_OBJECTBUFFER_H
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
@@ -49,7 +48,7 @@ public:
protected:
// The memory contained in an ObjectBuffer
- OwningPtr<MemoryBuffer> Buffer;
+ std::unique_ptr<MemoryBuffer> Buffer;
};
/// ObjectBufferStream - This class encapsulates the SmallVector and
diff --git a/include/llvm/ExecutionEngine/ObjectImage.h b/include/llvm/ExecutionEngine/ObjectImage.h
index 076f4b1146..0cf7f96fcf 100644
--- a/include/llvm/ExecutionEngine/ObjectImage.h
+++ b/include/llvm/ExecutionEngine/ObjectImage.h
@@ -28,7 +28,7 @@ class ObjectImage {
virtual void anchor();
protected:
- OwningPtr<ObjectBuffer> Buffer;
+ std::unique_ptr<ObjectBuffer> Buffer;
public:
ObjectImage(ObjectBuffer *Input) : Buffer(Input) {}
diff --git a/include/llvm/IR/Module.h b/include/llvm/IR/Module.h
index d489bd6c0c..f67b549015 100644
--- a/include/llvm/IR/Module.h
+++ b/include/llvm/IR/Module.h
@@ -15,7 +15,6 @@
#ifndef LLVM_IR_MODULE_H
#define LLVM_IR_MODULE_H
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
@@ -197,7 +196,8 @@ private:
NamedMDListType NamedMDList; ///< The named metadata in the module
std::string GlobalScopeAsm; ///< Inline Asm at global scope.
ValueSymbolTable *ValSymTab; ///< Symbol table for values
- OwningPtr<GVMaterializer> Materializer; ///< Used to materialize GlobalValues
+ std::unique_ptr<GVMaterializer>
+ Materializer; ///< Used to materialize GlobalValues
std::string ModuleID; ///< Human readable identifier for the module
std::string TargetTriple; ///< Platform target triple Module compiled on
void *NamedMDSymTab; ///< NamedMDNode names.
diff --git a/include/llvm/LTO/LTOModule.h b/include/llvm/LTO/LTOModule.h
index a70b71fa2e..1e4fa1b7b2 100644
--- a/include/llvm/LTO/LTOModule.h
+++ b/include/llvm/LTO/LTOModule.h
@@ -15,7 +15,6 @@
#define LTO_MODULE_H
#include "llvm-c/lto.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/IR/Mangler.h"
#include "llvm/IR/Module.h"
@@ -48,8 +47,8 @@ private:
const llvm::GlobalValue *symbol;
};
- llvm::OwningPtr<llvm::Module> _module;
- llvm::OwningPtr<llvm::TargetMachine> _target;
+ std::unique_ptr<llvm::Module> _module;
+ std::unique_ptr<llvm::TargetMachine> _target;
llvm::MCObjectFileInfo ObjFileInfo;
StringSet _linkeropt_strings;
std::vector<const char *> _deplibs;
diff --git a/include/llvm/LineEditor/LineEditor.h b/include/llvm/LineEditor/LineEditor.h
index 9335e75a56..42839edde0 100644
--- a/include/llvm/LineEditor/LineEditor.h
+++ b/include/llvm/LineEditor/LineEditor.h
@@ -111,7 +111,7 @@ public:
private:
std::string Prompt;
std::string HistoryPath;
- OwningPtr<InternalData> Data;
+ std::unique_ptr<InternalData> Data;
struct CompleterConcept {
virtual ~CompleterConcept();
@@ -145,7 +145,7 @@ private:
T Value;
};
- llvm::OwningPtr<const CompleterConcept> Completer;
+ std::unique_ptr<const CompleterConcept> Completer;
};
}
diff --git a/include/llvm/MC/MCDisassembler.h b/include/llvm/MC/MCDisassembler.h
index f82ebca525..de6020b610 100644
--- a/include/llvm/MC/MCDisassembler.h
+++ b/include/llvm/MC/MCDisassembler.h
@@ -56,10 +56,9 @@ public:
};
/// Constructor - Performs initial setup for the disassembler.
- MCDisassembler(const MCSubtargetInfo &STI) : GetOpInfo(0), SymbolLookUp(0),
- DisInfo(0), Ctx(0),
- STI(STI), Symbolizer(0),
- CommentStream(0) {}
+ MCDisassembler(const MCSubtargetInfo &STI)
+ : GetOpInfo(0), SymbolLookUp(0), DisInfo(0), Ctx(0), STI(STI),
+ Symbolizer(), CommentStream(0) {}
virtual ~MCDisassembler();
@@ -102,7 +101,7 @@ private:
protected:
// Subtarget information, for instruction decoding predicates if required.
const MCSubtargetInfo &STI;
- OwningPtr<MCSymbolizer> Symbolizer;
+ std::unique_ptr<MCSymbolizer> Symbolizer;
public:
// Helpers around MCSymbolizer
@@ -115,7 +114,7 @@ public:
/// Set \p Symzer as the current symbolizer.
/// This takes ownership of \p Symzer, and deletes the previously set one.
- void setSymbolizer(OwningPtr<MCSymbolizer> &Symzer);
+ void setSymbolizer(std::unique_ptr<MCSymbolizer> &Symzer);
/// Sets up an external symbolizer that uses the C API callbacks.
void setupForSymbolicDisassembly(LLVMOpInfoCallback GetOpInfo,
diff --git a/include/llvm/MC/MCExternalSymbolizer.h b/include/llvm/MC/MCExternalSymbolizer.h
index c942adca3b..40f1d0ecc4 100644
--- a/include/llvm/MC/MCExternalSymbolizer.h
+++ b/include/llvm/MC/MCExternalSymbolizer.h
@@ -18,6 +18,7 @@
#include "llvm-c/Disassembler.h"
#include "llvm/MC/MCSymbolizer.h"
+#include <memory>
namespace llvm {
@@ -38,12 +39,11 @@ class MCExternalSymbolizer : public MCSymbolizer {
public:
MCExternalSymbolizer(MCContext &Ctx,
- OwningPtr<MCRelocationInfo> &RelInfo,
+ std::unique_ptr<MCRelocationInfo> &RelInfo,
LLVMOpInfoCallback getOpInfo,
- LLVMSymbolLookupCallback symbolLookUp,
- void *disInfo)
- : MCSymbolizer(Ctx, RelInfo),
- GetOpInfo(getOpInfo), SymbolLookUp(symbolLookUp), DisInfo(disInfo) {}
+ LLVMSymbolLookupCallback symbolLookUp, void *disInfo)
+ : MCSymbolizer(Ctx, RelInfo), GetOpInfo(getOpInfo),
+ SymbolLookUp(symbolLookUp), DisInfo(disInfo) {}
bool tryAddingSymbolicOperand(MCInst &MI, raw_ostream &CommentStream,
int64_t Value,
diff --git a/include/llvm/MC/MCMachObjectWriter.h b/include/llvm/MC/MCMachObjectWriter.h
index 3ba6e65100..38e00110b5 100644
--- a/include/llvm/MC/MCMachObjectWriter.h
+++ b/include/llvm/MC/MCMachObjectWriter.h
@@ -11,7 +11,6 @@
#define LLVM_MC_MCMACHOBJECTWRITER_H
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCObjectWriter.h"
@@ -92,7 +91,7 @@ class MachObjectWriter : public MCObjectWriter {
};
/// The target specific Mach-O writer instance.
- llvm::OwningPtr<MCMachObjectTargetWriter> TargetObjectWriter;
+ std::unique_ptr<MCMachObjectTargetWriter> TargetObjectWriter;
/// @name Relocation Data
/// @{
diff --git a/include/llvm/MC/MCModuleYAML.h b/include/llvm/MC/MCModuleYAML.h
index 281e3d8dc9..c4ae829535 100644
--- a/include/llvm/MC/MCModuleYAML.h
+++ b/include/llvm/MC/MCModuleYAML.h
@@ -16,7 +16,6 @@
#ifndef LLVM_MC_MCMODULEYAML_H
#define LLVM_MC_MCMODULEYAML_H
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCModule.h"
#include "llvm/Support/raw_ostream.h"
@@ -33,7 +32,7 @@ StringRef mcmodule2yaml(raw_ostream &OS, const MCModule &MCM,
/// \brief Creates a new module and returns it in \p MCM.
/// \returns The empty string on success, an error message on failure.
-StringRef yaml2mcmodule(OwningPtr<MCModule> &MCM, StringRef YamlContent,
+StringRef yaml2mcmodule(std::unique_ptr<MCModule> &MCM, StringRef YamlContent,
const MCInstrInfo &MII, const MCRegisterInfo &MRI);
} // end namespace llvm
diff --git a/include/llvm/MC/MCObjectDisassembler.h b/include/llvm/MC/MCObjectDisassembler.h
index 10cc04b945..5b935db595 100644
--- a/include/llvm/MC/MCObjectDisassembler.h
+++ b/include/llvm/MC/MCObjectDisassembler.h
@@ -16,7 +16,6 @@
#define LLVM_MC_MCOBJECTDISASSEMBLER_H
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/MemoryObject.h"
@@ -67,7 +66,7 @@ public:
/// \brief Set the region on which to fallback if disassembly was requested
/// somewhere not accessible in the object file.
/// This is used for dynamic disassembly (see RawMemoryObject).
- void setFallbackRegion(OwningPtr<MemoryObject> &Region) {
+ void setFallbackRegion(std::unique_ptr<MemoryObject> &Region) {
FallbackRegion.reset(Region.release());
}
@@ -113,7 +112,7 @@ protected:
MCObjectSymbolizer *MOS;
/// \brief The fallback memory region, outside the object file.
- OwningPtr<MemoryObject> FallbackRegion;
+ std::unique_ptr<MemoryObject> FallbackRegion;
/// \brief Return a memory region suitable for reading starting at \p Addr.
/// In most cases, this returns a StringRefMemoryObject backed by the
diff --git a/include/llvm/MC/MCObjectSymbolizer.h b/include/llvm/MC/MCObjectSymbolizer.h
index 64b932ebe4..6f14b561c0 100644
--- a/include/llvm/MC/MCObjectSymbolizer.h
+++ b/include/llvm/MC/MCObjectSymbolizer.h
@@ -41,7 +41,7 @@ protected:
const object::RelocationRef *findRelocationAt(uint64_t Addr);
const object::SectionRef *findSectionContaining(uint64_t Addr);
- MCObjectSymbolizer(MCContext &Ctx, OwningPtr<MCRelocationInfo> &RelInfo,
+ MCObjectSymbolizer(MCContext &Ctx, std::unique_ptr<MCRelocationInfo> &RelInfo,
const object::ObjectFile *Obj);
public:
@@ -63,8 +63,9 @@ public:
/// \brief Create an object symbolizer for \p Obj.
static MCObjectSymbolizer *
- createObjectSymbolizer(MCContext &Ctx, OwningPtr<MCRelocationInfo> &RelInfo,
- const object::ObjectFile *Obj);
+ createObjectSymbolizer(MCContext &Ctx,
+ std::unique_ptr<MCRelocationInfo> &RelInfo,
+ const object::ObjectFile *Obj);
private:
typedef DenseMap<uint64_t, object::RelocationRef> AddrToRelocMap;
diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h
index e9f6196063..02b1a40c08 100644
--- a/include/llvm/MC/MCStreamer.h
+++ b/include/llvm/MC/MCStreamer.h
@@ -130,7 +130,7 @@ public:
void emitCurrentConstantPool();
private:
- OwningPtr<AssemblerConstantPools> ConstantPools;
+ std::unique_ptr<AssemblerConstantPools> ConstantPools;
};
/// MCStreamer - Streaming machine code generation interface. This interface
@@ -144,7 +144,7 @@ private:
///
class MCStreamer {
MCContext &Context;
- OwningPtr<MCTargetStreamer> TargetStreamer;
+ std::unique_ptr<MCTargetStreamer> TargetStreamer;
MCStreamer(const MCStreamer &) LLVM_DELETED_FUNCTION;
MCStreamer &operator=(const MCStreamer &) LLVM_DELETED_FUNCTION;
diff --git a/include/llvm/MC/MCSymbolizer.h b/include/llvm/MC/MCSymbolizer.h
index e42a2146dc..954e9ce416 100644
--- a/include/llvm/MC/MCSymbolizer.h
+++ b/include/llvm/MC/MCSymbolizer.h
@@ -16,10 +16,10 @@
#ifndef LLVM_MC_MCSYMBOLIZER_H
#define LLVM_MC_MCSYMBOLIZER_H
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/MC/MCRelocationInfo.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
+#include <memory>
namespace llvm {
@@ -42,11 +42,11 @@ class MCSymbolizer {
protected:
MCContext &Ctx;
- OwningPtr<MCRelocationInfo> RelInfo;
+ std::unique_ptr<MCRelocationInfo> RelInfo;
public:
/// \brief Construct an MCSymbolizer, taking ownership of \p RelInfo.
- MCSymbolizer(MCContext &Ctx, OwningPtr<MCRelocationInfo> &RelInfo);
+ MCSymbolizer(MCContext &Ctx, std::unique_ptr<MCRelocationInfo> &RelInfo);
virtual ~MCSymbolizer();
/// \brief Try to add a symbolic operand instead of \p Value to the MCInst.
diff --git a/include/llvm/Object/IRObjectFile.h b/include/llvm/Object/IRObjectFile.h
index 5fcbb386d8..78f5b2b64f 100644
--- a/include/llvm/Object/IRObjectFile.h
+++ b/include/llvm/Object/IRObjectFile.h
@@ -23,8 +23,9 @@ class GlobalValue;
namespace object {
class IRObjectFile : public SymbolicFile {
- OwningPtr<Module> M;
- OwningPtr<Mangler> Mang;
+ std::unique_ptr<Module> M;
+ std::unique_ptr<Mangler> Mang;
+
public:
IRObjectFile(MemoryBuffer *Object, error_code &EC, LLVMContext &Context,
bool BufferOwned);
diff --git a/include/llvm/Object/MachOUniversal.h b/include/llvm/Object/MachOUniversal.h
index ba02df9071..9b1afd2072 100644
--- a/include/llvm/Object/MachOUniversal.h
+++ b/include/llvm/Object/MachOUniversal.h
@@ -14,7 +14,6 @@
#ifndef LLVM_OBJECT_MACHOUNIVERSAL_H
#define LLVM_OBJECT_MACHOUNIVERSAL_H
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Object/Binary.h"
@@ -53,7 +52,7 @@ public:
ObjectForArch getNext() const { return ObjectForArch(Parent, Index + 1); }
uint32_t getCPUType() const { return Header.cputype; }
- error_code getAsObjectFile(OwningPtr<ObjectFile> &Result) const;
+ error_code getAsObjectFile(std::unique_ptr<ObjectFile> &Result) const;
};
class object_iterator {
@@ -95,7 +94,7 @@ public:
}
error_code getObjectForArch(Triple::ArchType Arch,
- OwningPtr<ObjectFile> &Result) const;
+ std::unique_ptr<ObjectFile> &Result) const;
};
}
diff --git a/include/llvm/Support/Compression.h b/include/llvm/Support/Compression.h
index ea3962ecd9..80eff5c628 100644
--- a/include/llvm/Support/Compression.h
+++ b/include/llvm/Support/Compression.h
@@ -15,11 +15,11 @@
#define LLVM_SUPPORT_COMPRESSION_H
#include "llvm/Support/DataTypes.h"
+#include <memory>
namespace llvm {
class MemoryBuffer;
-template<typename T> class OwningPtr;
class StringRef;
namespace zlib {
@@ -43,11 +43,11 @@ enum Status {
bool isAvailable();
Status compress(StringRef InputBuffer,
- OwningPtr<MemoryBuffer> &CompressedBuffer,
+ std::unique_ptr<MemoryBuffer> &CompressedBuffer,
CompressionLevel Level = DefaultCompression);
Status uncompress(StringRef InputBuffer,
- OwningPtr<MemoryBuffer> &UncompressedBuffer,
+ std::unique_ptr<MemoryBuffer> &UncompressedBuffer,
size_t UncompressedSize);
uint32_t crc32(StringRef Buffer);
diff --git a/include/llvm/Support/FileSystem.h b/include/llvm/Support/FileSystem.h
index b57a8b07a3..1812d24ead 100644
--- a/include/llvm/Support/FileSystem.h
+++ b/include/llvm/Support/FileSystem.h
@@ -28,7 +28,6 @@
#define LLVM_SUPPORT_FILESYSTEM_H
#include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/DataTypes.h"
diff --git a/include/llvm/Support/StreamableMemoryObject.h b/include/llvm/Support/StreamableMemoryObject.h
index 1eb4c32dbc..e2908756c3 100644
--- a/include/llvm/Support/StreamableMemoryObject.h
+++ b/include/llvm/Support/StreamableMemoryObject.h
@@ -11,10 +11,11 @@
#ifndef LLVM_SUPPORT_STREAMABLEMEMORYOBJECT_H
#define LLVM_SUPPORT_STREAMABLEMEMORYOBJECT_H
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataStream.h"
#include "llvm/Support/MemoryObject.h"
+#include <cassert>
+#include <memory>
#include <vector>
namespace llvm {
@@ -137,7 +138,7 @@ public:
private:
const static uint32_t kChunkSize = 4096 * 4;
mutable std::vector<unsigned char> Bytes;
- OwningPtr<DataStreamer> Streamer;
+ std::unique_ptr<DataStreamer> Streamer;
mutable size_t BytesRead; // Bytes read from stream
size_t BytesSkipped;// Bytes skipped at start of stream (e.g. wrapper/header)
mutable size_t ObjectSize; // 0 if unknown, set if wrapper seen or EOF reached
diff --git a/include/llvm/Support/YAMLParser.h b/include/llvm/Support/YAMLParser.h
index 492d6ec7fc..c11aa25094 100644
--- a/include/llvm/Support/YAMLParser.h
+++ b/include/llvm/Support/YAMLParser.h
@@ -38,7 +38,6 @@
#ifndef LLVM_SUPPORT_YAMLPARSER_H
#define LLVM_SUPPORT_YAMLPARSER_H
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Allocator.h"
@@ -96,8 +95,8 @@ public:
void printError(Node *N, const Twine &Msg);
private:
- OwningPtr<Scanner> scanner;
- OwningPtr<Document> CurrentDoc;
+ std::unique_ptr<Scanner> scanner;
+ std::unique_ptr<Document> CurrentDoc;
friend class Document;
};
@@ -115,7 +114,7 @@ public:
NK_Alias
};
- Node(unsigned int Type, OwningPtr<Document> &, StringRef Anchor,
+ Node(unsigned int Type, std::unique_ptr<Document> &, StringRef Anchor,
StringRef Tag);
/// @brief Get the value of the anchor attached to this node. If it does not
@@ -156,7 +155,7 @@ public:
}
protected:
- OwningPtr<Document> &Doc;
+ std::unique_ptr<Document> &Doc;
SMRange SourceRange;
void operator delete(void *) throw() {}
@@ -177,7 +176,7 @@ private:
class NullNode : public Node {
void anchor() override;
public:
- NullNode(OwningPtr<Document> &D)
+ NullNode(std::unique_ptr<Document> &D)
: Node(NK_Null, D, StringRef(), StringRef()) {}
static inline bool classof(const Node *N) {
@@ -193,7 +192,7 @@ public:
class ScalarNode : public Node {
void anchor() override;
public:
- ScalarNode(OwningPtr<Document> &D, StringRef Anchor, StringRef Tag,
+ ScalarNode(std::unique_ptr<Document> &D, StringRef Anchor, StringRef Tag,
StringRef Val)
: Node(NK_Scalar, D, Anchor, Tag), Value(Val) {
SMLoc Start = SMLoc::getFromPointer(Val.begin());
@@ -235,11 +234,8 @@ private:
class KeyValueNode : public Node {
void anchor() override;
public:
- KeyValueNode(OwningPtr<Document> &D)
- : Node(NK_KeyValue, D, StringRef(), StringRef())
- , Key(0)
- , Value(0)
- {}
+ KeyValueNode(std::unique_ptr<Document> &D)
+ : Node(NK_KeyValue, D, StringRef(), StringRef()), Key(0), Value(0) {}
/// @brief Parse and return the key.
///
@@ -353,7 +349,7 @@ public:
MT_Inline ///< An inline mapping node is used for "[key: value]".
};
- MappingNode(OwningPtr<Document> &D, StringRef Anchor, StringRef Tag,
+ MappingNode(std::unique_ptr<Document> &D, StringRef Anchor, StringRef Tag,
MappingType MT)
: Node(NK_Mapping, D, Anchor, Tag), Type(MT), IsAtBeginning(true),
IsAtEnd(false), CurrentEntry(0) {}
@@ -410,7 +406,7 @@ public:
ST_Indentless
};
- SequenceNode(OwningPtr<Document> &D, StringRef Anchor, StringRef Tag,
+ SequenceNode(std::unique_ptr<Document> &D, StringRef Anchor, StringRef Tag,
SequenceType ST)
: Node(NK_Sequence, D, Anchor, Tag), SeqType(ST), IsAtBeginning(true),
IsAtEnd(false),
@@ -453,8 +449,8 @@ private:
class AliasNode : public Node {
void anchor() override;
public:
- AliasNode(OwningPtr<Document> &D, StringRef Val)
- : Node(NK_Alias, D, StringRef(), StringRef()), Name(Val) {}
+ AliasNode(std::unique_ptr<Document> &D, StringRef Val)
+ : Node(NK_Alias, D, StringRef(), StringRef()), Name(Val) {}
StringRef getName() const { return Name; }
Node *getTarget();
@@ -531,7 +527,7 @@ private:
class document_iterator {
public:
document_iterator() : Doc(0) {}
- document_iterator(OwningPtr<Document> &D) : Doc(&D) {}
+ document_iterator(std::unique_ptr<Document> &D) : Doc(&D) {}
bool operator ==(const document_iterator &Other) {
if (isAtEnd() || Other.isAtEnd())
@@ -558,16 +554,14 @@ public:
return *Doc->get();
}
- OwningPtr<Document> &operator ->() {
- return *Doc;
- }
+ std::unique_ptr<Document> &operator->() { return *Doc; }
private:
bool isAtEnd() const {
return !Doc || !*Doc;
}
- OwningPtr<Document> *Doc;
+ std::unique_ptr<Document> *Doc;
};
}
diff --git a/include/llvm/Support/YAMLTraits.h b/include/llvm/Support/YAMLTraits.h
index b2f214b42e..e5d2308aee 100644
--- a/include/llvm/Support/YAMLTraits.h
+++ b/include/llvm/Support/YAMLTraits.h
@@ -852,15 +852,15 @@ public:
void nextDocument();
private:
- llvm::SourceMgr SrcMgr; // must be before Strm
- OwningPtr<llvm::yaml::Stream> Strm;
- OwningPtr<HNode> TopNode;
- llvm::error_code EC;
- llvm::BumpPtrAllocator StringAllocator;
- llvm::yaml::document_iterator DocIterator;
- std::vector<bool> BitValuesUsed;
- HNode *CurrentNode;
- bool ScalarMatchFound;
+ llvm::SourceMgr SrcMgr; // must be before Strm
+ std::unique_ptr<llvm::yaml::Stream> Strm;
+ std::unique_ptr<HNode> TopNode;
+ llvm::error_code EC;
+ llvm::BumpPtrAllocator StringAllocator;
+ llvm::yaml::document_iterator DocIterator;
+ std::vector<bool> BitValuesUsed;
+ HNode *CurrentNode;
+ bool ScalarMatchFound;
};