summaryrefslogtreecommitdiff
path: root/tools
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 /tools
parentca8b562f2d4d996d5198af537ad312e544da1172 (diff)
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 'tools')
-rw-r--r--tools/bugpoint/BugDriver.cpp2
-rw-r--r--tools/bugpoint/Miscompilation.cpp7
-rw-r--r--tools/gold/gold-plugin.cpp3
-rw-r--r--tools/llc/llc.cpp13
-rw-r--r--tools/lli/lli.cpp6
-rw-r--r--tools/llvm-ar/llvm-ar.cpp4
-rw-r--r--tools/llvm-as/llvm-as.cpp6
-rw-r--r--tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp3
-rw-r--r--tools/llvm-cov/llvm-cov.cpp5
-rw-r--r--tools/llvm-dis/llvm-dis.cpp8
-rw-r--r--tools/llvm-dwarfdump/llvm-dwarfdump.cpp7
-rw-r--r--tools/llvm-extract/llvm-extract.cpp2
-rw-r--r--tools/llvm-jitlistener/llvm-jitlistener.cpp10
-rw-r--r--tools/llvm-link/llvm-link.cpp6
-rw-r--r--tools/llvm-lto/llvm-lto.cpp4
-rw-r--r--tools/llvm-mc/Disassembler.cpp3
-rw-r--r--tools/llvm-mc/llvm-mc.cpp25
-rw-r--r--tools/llvm-mcmarkup/llvm-mcmarkup.cpp3
-rw-r--r--tools/llvm-nm/llvm-nm.cpp8
-rw-r--r--tools/llvm-objdump/MachODump.cpp32
-rw-r--r--tools/llvm-objdump/llvm-objdump.cpp44
-rw-r--r--tools/llvm-profdata/llvm-profdata.cpp5
-rw-r--r--tools/llvm-readobj/COFFDumper.cpp5
-rw-r--r--tools/llvm-readobj/ELFDumper.cpp7
-rw-r--r--tools/llvm-readobj/MachODumper.cpp4
-rw-r--r--tools/llvm-readobj/ObjDumper.h19
-rw-r--r--tools/llvm-readobj/llvm-readobj.cpp11
-rw-r--r--tools/llvm-rtdyld/llvm-rtdyld.cpp12
-rw-r--r--tools/llvm-size/llvm-size.cpp4
-rw-r--r--tools/llvm-stress/llvm-stress.cpp24
-rw-r--r--tools/llvm-symbolizer/LLVMSymbolize.cpp6
-rw-r--r--tools/llvm-symbolizer/LLVMSymbolize.h3
-rw-r--r--tools/macho-dump/macho-dump.cpp2
-rw-r--r--tools/obj2yaml/obj2yaml.cpp3
-rw-r--r--tools/opt/opt.cpp8
-rw-r--r--tools/yaml2obj/yaml2obj.cpp3
36 files changed, 149 insertions, 168 deletions
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp
index c23a7912c75..2d1b903829f 100644
--- a/tools/bugpoint/BugDriver.cpp
+++ b/tools/bugpoint/BugDriver.cpp
@@ -122,7 +122,7 @@ bool BugDriver::addSources(const std::vector<std::string> &Filenames) {
outs() << "Read input file : '" << Filenames[0] << "'\n";
for (unsigned i = 1, e = Filenames.size(); i != e; ++i) {
- OwningPtr<Module> M(ParseInputFile(Filenames[i], Context));
+ std::unique_ptr<Module> M(ParseInputFile(Filenames[i], Context));
if (M.get() == 0) return true;
outs() << "Linking in input file: '" << Filenames[i] << "'\n";
diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp
index 8aebe5ea839..db26fe2ea00 100644
--- a/tools/bugpoint/Miscompilation.cpp
+++ b/tools/bugpoint/Miscompilation.cpp
@@ -128,8 +128,8 @@ ReduceMiscompilingPasses::doTest(std::vector<std::string> &Prefix,
// Ok, so now we know that the prefix passes work, try running the suffix
// passes on the result of the prefix passes.
//
- OwningPtr<Module> PrefixOutput(ParseInputFile(BitcodeResult,
- BD.getContext()));
+ std::unique_ptr<Module> PrefixOutput(
+ ParseInputFile(BitcodeResult, BD.getContext()));
if (!PrefixOutput) {
errs() << BD.getToolName() << ": Error reading bitcode file '"
<< BitcodeResult << "'!\n";
@@ -145,7 +145,8 @@ ReduceMiscompilingPasses::doTest(std::vector<std::string> &Prefix,
<< "' passes compile correctly after the '"
<< getPassesString(Prefix) << "' passes: ";
- OwningPtr<Module> OriginalInput(BD.swapProgramIn(PrefixOutput.release()));
+ std::unique_ptr<Module> OriginalInput(
+ BD.swapProgramIn(PrefixOutput.release()));
if (BD.runPasses(BD.getProgram(), Suffix, BitcodeResult, false/*delete*/,
true/*quiet*/)) {
errs() << " Error running this sequence of passes"
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
index 31a1555ebba..4726d82d69c 100644
--- a/tools/gold/gold-plugin.cpp
+++ b/tools/gold/gold-plugin.cpp
@@ -14,7 +14,6 @@
#include "llvm/Config/config.h" // plugin-api.h requires HAVE_STDINT_H
#include "llvm-c/lto.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/FileSystem.h"
@@ -246,7 +245,7 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
int *claimed) {
lto_module_t M;
const void *view;
- OwningPtr<MemoryBuffer> buffer;
+ std::unique_ptr<MemoryBuffer> buffer;
if (get_view) {
if (get_view(file->handle, &view) != LDPS_OK) {
(*message)(LDPL_ERROR, "Failed to get a view of %s", file->name);
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index bb72f252fe4..8fbdc49e5ee 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -206,7 +206,7 @@ int main(int argc, char **argv) {
static int compileModule(char **argv, LLVMContext &Context) {
// Load the module to be compiled...
SMDiagnostic Err;
- OwningPtr<Module> M;
+ std::unique_ptr<Module> M;
Module *mod = 0;
Triple TheTriple;
@@ -266,10 +266,9 @@ static int compileModule(char **argv, LLVMContext &Context) {
TargetOptions Options = InitTargetOptionsFromCodeGenFlags();
Options.DisableIntegratedAS = NoIntegratedAssembler;
- OwningPtr<TargetMachine>
- target(TheTarget->createTargetMachine(TheTriple.getTriple(),
- MCPU, FeaturesStr, Options,
- RelocModel, CMModel, OLvl));
+ std::unique_ptr<TargetMachine> target(
+ TheTarget->createTargetMachine(TheTriple.getTriple(), MCPU, FeaturesStr,
+ Options, RelocModel, CMModel, OLvl));
assert(target.get() && "Could not allocate target machine!");
assert(mod && "Should have exited after outputting help!");
TargetMachine &Target = *target.get();
@@ -284,8 +283,8 @@ static int compileModule(char **argv, LLVMContext &Context) {
FloatABIForCalls = FloatABI::Soft;
// Figure out where we are going to send the output.
- OwningPtr<tool_output_file> Out
- (GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]));
+ std::unique_ptr<tool_output_file> Out(
+ GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]));
if (!Out) return 1;
// Build up all of the passes that we want to do to the module.
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp
index 7bbc5dc97bf..a9125a48b8f 100644
--- a/tools/lli/lli.cpp
+++ b/tools/lli/lli.cpp
@@ -284,7 +284,7 @@ public:
if (!getCacheFilename(ModuleID, CacheName))
return NULL;
// Load the object from the cache filename
- OwningPtr<MemoryBuffer> IRObjectBuffer;
+ std::unique_ptr<MemoryBuffer> IRObjectBuffer;
MemoryBuffer::getFile(CacheName.c_str(), IRObjectBuffer, -1, false);
// If the file isn't there, that's OK.
if (!IRObjectBuffer)
@@ -537,7 +537,7 @@ int main(int argc, char **argv, char * const *envp) {
}
for (unsigned i = 0, e = ExtraArchives.size(); i != e; ++i) {
- OwningPtr<MemoryBuffer> ArBuf;
+ std::unique_ptr<MemoryBuffer> ArBuf;
error_code ec;
ec = MemoryBuffer::getFileOrSTDIN(ExtraArchives[i], ArBuf);
if (ec) {
@@ -662,7 +662,7 @@ int main(int argc, char **argv, char * const *envp) {
// address space, assign the section addresses to resolve any relocations,
// and send it to the target.
- OwningPtr<RemoteTarget> Target;
+ std::unique_ptr<RemoteTarget> Target;
if (!ChildExecPath.empty()) { // Remote execution on a child process
#ifndef LLVM_ON_UNIX
// FIXME: Remove this pointless fallback mode which causes tests to "pass"
diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp
index e1987b107fe..047f54e56ee 100644
--- a/tools/llvm-ar/llvm-ar.cpp
+++ b/tools/llvm-ar/llvm-ar.cpp
@@ -770,7 +770,7 @@ static void performWriteOperation(ArchiveOperation Operation,
MemberBuffers.resize(NewMembers.size());
for (unsigned I = 0, N = NewMembers.size(); I < N; ++I) {
- OwningPtr<MemoryBuffer> MemberBuffer;
+ std::unique_ptr<MemoryBuffer> MemberBuffer;
NewArchiveIterator &Member = NewMembers[I];
if (Member.isNewMember()) {
@@ -938,7 +938,7 @@ int ar_main(char **argv) {
static int performOperation(ArchiveOperation Operation) {
// Create or open the archive object.
- OwningPtr<MemoryBuffer> Buf;
+ std::unique_ptr<MemoryBuffer> Buf;
error_code EC = MemoryBuffer::getFile(ArchiveName, Buf, -1, false);
if (EC && EC != llvm::errc::no_such_file_or_directory) {
errs() << ToolName << ": error opening '" << ArchiveName
diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp
index a9a230536ee..7583b121b45 100644
--- a/tools/llvm-as/llvm-as.cpp
+++ b/tools/llvm-as/llvm-as.cpp
@@ -69,8 +69,8 @@ static void WriteOutputFile(const Module *M) {
}
std::string ErrorInfo;
- OwningPtr<tool_output_file> Out(new tool_output_file(
- OutputFilename.c_str(), ErrorInfo, sys::fs::F_None));
+ std::unique_ptr<tool_output_file> Out(
+ new tool_output_file(OutputFilename.c_str(), ErrorInfo, sys::fs::F_None));
if (!ErrorInfo.empty()) {
errs() << ErrorInfo << '\n';
exit(1);
@@ -93,7 +93,7 @@ int main(int argc, char **argv) {
// Parse the file now...
SMDiagnostic Err;
- OwningPtr<Module> M(ParseAssemblyFile(InputFilename, Err, Context));
+ std::unique_ptr<Module> M(ParseAssemblyFile(InputFilename, Err, Context));
if (M.get() == 0) {
Err.print(argv[0], errs());
return 1;
diff --git a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
index 632f85e7461..9e17783e707 100644
--- a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
+++ b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
@@ -27,7 +27,6 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/Bitcode/BitstreamReader.h"
#include "llvm/Bitcode/LLVMBitCodes.h"
#include "llvm/Bitcode/ReaderWriter.h"
@@ -479,7 +478,7 @@ static void PrintSize(uint64_t Bits) {
/// AnalyzeBitcode - Analyze the bitcode file specified by InputFilename.
static int AnalyzeBitcode() {
// Read the input file.
- OwningPtr<MemoryBuffer> MemBuf;
+ std::unique_ptr<MemoryBuffer> MemBuf;
if (error_code ec =
MemoryBuffer::getFileOrSTDIN(InputFilename, MemBuf))
diff --git a/tools/llvm-cov/llvm-cov.cpp b/tools/llvm-cov/llvm-cov.cpp
index ce59694ad29..587ee11899b 100644
--- a/tools/llvm-cov/llvm-cov.cpp
+++ b/tools/llvm-cov/llvm-cov.cpp
@@ -11,7 +11,6 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
@@ -96,7 +95,7 @@ int main(int argc, char **argv) {
GCOVFile GF;
- OwningPtr<MemoryBuffer> GCNO_Buff;
+ std::unique_ptr<MemoryBuffer> GCNO_Buff;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputGCNO, GCNO_Buff)) {
errs() << InputGCNO << ": " << ec.message() << "\n";
return 1;
@@ -107,7 +106,7 @@ int main(int argc, char **argv) {
return 1;
}
- OwningPtr<MemoryBuffer> GCDA_Buff;
+ std::unique_ptr<MemoryBuffer> GCDA_Buff;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputGCDA, GCDA_Buff)) {
if (ec != errc::no_such_file_or_directory) {
errs() << InputGCDA << ": " << ec.message() << "\n";
diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp
index b1263d5cc9d..df649cccffb 100644
--- a/tools/llvm-dis/llvm-dis.cpp
+++ b/tools/llvm-dis/llvm-dis.cpp
@@ -123,7 +123,7 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, "llvm .bc -> .ll disassembler\n");
std::string ErrorMessage;
- OwningPtr<Module> M;
+ std::unique_ptr<Module> M;
// Use the bitcode streaming interface
DataStreamer *streamer = getDataFileStreamer(InputFilename, &ErrorMessage);
@@ -171,14 +171,14 @@ int main(int argc, char **argv) {
}
std::string ErrorInfo;
- OwningPtr<tool_output_file> Out(new tool_output_file(
- OutputFilename.c_str(), ErrorInfo, sys::fs::F_None));
+ std::unique_ptr<tool_output_file> Out(
+ new tool_output_file(OutputFilename.c_str(), ErrorInfo, sys::fs::F_None));
if (!ErrorInfo.empty()) {
errs() << ErrorInfo << '\n';
return 1;
}
- OwningPtr<AssemblyAnnotationWriter> Annotator;
+ std::unique_ptr<AssemblyAnnotationWriter> Annotator;
if (ShowAnnotations)
Annotator.reset(new CommentWriter());
diff --git a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
index 05e8d630d98..f019e9e9a98 100644
--- a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -11,7 +11,6 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Triple.h"
#include "llvm/DebugInfo/DIContext.h"
@@ -87,7 +86,7 @@ static void PrintDILineInfo(DILineInfo dli) {
}
static void DumpInput(const StringRef &Filename) {
- OwningPtr<MemoryBuffer> Buff;
+ std::unique_ptr<MemoryBuffer> Buff;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename, Buff)) {
errs() << Filename << ": " << ec.message() << "\n";
@@ -99,9 +98,9 @@ static void DumpInput(const StringRef &Filename) {
errs() << Filename << ": " << EC.message() << '\n';
return;
}
- OwningPtr<ObjectFile> Obj(ObjOrErr.get());
+ std::unique_ptr<ObjectFile> Obj(ObjOrErr.get());
- OwningPtr<DIContext> DICtx(DIContext::getDWARFContext(Obj.get()));
+ std::unique_ptr<DIContext> DICtx(DIContext::getDWARFContext(Obj.get()));
if (Address == -1ULL) {
outs() << Filename
diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp
index b1c1f68f55f..2e5a2af244d 100644
--- a/tools/llvm-extract/llvm-extract.cpp
+++ b/tools/llvm-extract/llvm-extract.cpp
@@ -100,7 +100,7 @@ int main(int argc, char **argv) {
// Use lazy loading, since we only care about selected global values.
SMDiagnostic Err;
- OwningPtr<Module> M;
+ std::unique_ptr<Module> M;
M.reset(getLazyIRFileModule(InputFilename, Err, Context));
if (M.get() == 0) {
diff --git a/tools/llvm-jitlistener/llvm-jitlistener.cpp b/tools/llvm-jitlistener/llvm-jitlistener.cpp
index dbaf075e91c..a9bbc702a90 100644
--- a/tools/llvm-jitlistener/llvm-jitlistener.cpp
+++ b/tools/llvm-jitlistener/llvm-jitlistener.cpp
@@ -15,7 +15,6 @@
#include "llvm/IR/LLVMContext.h"
#include "../../lib/ExecutionEngine/IntelJITEvents/IntelJITEventsWrapper.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ExecutionEngine/JITEventListener.h"
#include "llvm/ExecutionEngine/JITMemoryManager.h"
@@ -163,16 +162,15 @@ protected:
LLVMContext Context; // Global ownership
Module *TheModule; // Owned by ExecutionEngine.
JITMemoryManager *JMM; // Owned by ExecutionEngine.
- OwningPtr<ExecutionEngine> TheJIT;
+ std::unique_ptr<ExecutionEngine> TheJIT;
public:
void ProcessInput(const std::string &Filename) {
InitEE(Filename);
- llvm::OwningPtr<llvm::JITEventListener> Listener(JITEventListener::createIntelJITEventListener(
- new IntelJITEventsWrapper(NotifyEvent, 0,
- IsProfilingActive, 0, 0,
- GetNewMethodID)));
+ std::unique_ptr<llvm::JITEventListener> Listener(
+ JITEventListener::createIntelJITEventListener(new IntelJITEventsWrapper(
+ NotifyEvent, 0, IsProfilingActive, 0, 0, GetNewMethodID)));
TheJIT->RegisterJITEventListener(Listener.get());
diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp
index 14491482870..1f0e2246ce8 100644
--- a/tools/llvm-link/llvm-link.cpp
+++ b/tools/llvm-link/llvm-link.cpp
@@ -82,8 +82,8 @@ int main(int argc, char **argv) {
unsigned BaseArg = 0;
std::string ErrorMessage;
- OwningPtr<Module> Composite(LoadFile(argv[0],
- InputFilenames[BaseArg], Context));
+ std::unique_ptr<Module> Composite(
+ LoadFile(argv[0], InputFilenames[BaseArg], Context));
if (Composite.get() == 0) {
errs() << argv[0] << ": error loading file '"
<< InputFilenames[BaseArg] << "'\n";
@@ -92,7 +92,7 @@ int main(int argc, char **argv) {
Linker L(Composite.get(), SuppressWarnings);
for (unsigned i = BaseArg+1; i < InputFilenames.size(); ++i) {
- OwningPtr<Module> M(LoadFile(argv[0], InputFilenames[i], Context));
+ std::unique_ptr<Module> M(LoadFile(argv[0], InputFilenames[i], Context));
if (M.get() == 0) {
errs() << argv[0] << ": error loading file '" <<InputFilenames[i]<< "'\n";
return 1;
diff --git a/tools/llvm-lto/llvm-lto.cpp b/tools/llvm-lto/llvm-lto.cpp
index d984773cddb..ec3f0fa2333 100644
--- a/tools/llvm-lto/llvm-lto.cpp
+++ b/tools/llvm-lto/llvm-lto.cpp
@@ -95,8 +95,8 @@ int main(int argc, char **argv) {
for (unsigned i = BaseArg; i < InputFilenames.size(); ++i) {
std::string error;
- OwningPtr<LTOModule> Module(LTOModule::makeLTOModule(InputFilenames[i].c_str(),
- Options, error));
+ std::unique_ptr<LTOModule> Module(
+ LTOModule::makeLTOModule(InputFilenames[i].c_str(), Options, error));
if (!error.empty()) {
errs() << argv[0] << ": error loading file '" << InputFilenames[i]
<< "': " << error << "\n";
diff --git a/tools/llvm-mc/Disassembler.cpp b/tools/llvm-mc/Disassembler.cpp
index 92fc3a3f03f..509a1d4ec34 100644
--- a/tools/llvm-mc/Disassembler.cpp
+++ b/tools/llvm-mc/Disassembler.cpp
@@ -13,7 +13,6 @@
//===----------------------------------------------------------------------===//
#include "Disassembler.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/Triple.h"
#include "llvm/MC/MCDisassembler.h"
#include "llvm/MC/MCInst.h"
@@ -159,7 +158,7 @@ int Disassembler::disassemble(const Target &T,
MemoryBuffer &Buffer,
SourceMgr &SM,
raw_ostream &Out) {
- OwningPtr<const MCDisassembler> DisAsm(T.createMCDisassembler(STI));
+ std::unique_ptr<const MCDisassembler> DisAsm(T.createMCDisassembler(STI));
if (!DisAsm) {
errs() << "error: no disassembler for target " << Triple << "\n";
return -1;
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index 9061f1d1b38..3e76f35dc62 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -13,7 +13,6 @@
//===----------------------------------------------------------------------===//
#include "Disassembler.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
@@ -320,9 +319,9 @@ static int AsLexInput(SourceMgr &SrcMgr, MCAsmInfo &MAI, tool_output_file *Out)
static int AssembleInput(const char *ProgName, const Target *TheTarget,
SourceMgr &SrcMgr, MCContext &Ctx, MCStreamer &Str,
MCAsmInfo &MAI, MCSubtargetInfo &STI, MCInstrInfo &MCII) {
- OwningPtr<MCAsmParser> Parser(createMCAsmParser(SrcMgr, Ctx,
- Str, MAI));
- OwningPtr<MCTargetAsmParser> TAP(TheTarget->createMCAsmParser(STI, *Parser, MCII));
+ std::unique_ptr<MCAsmParser> Parser(createMCAsmParser(SrcMgr, Ctx, Str, MAI));
+ std::unique_ptr<MCTargetAsmParser> TAP(
+ TheTarget->createMCAsmParser(STI, *Parser, MCII));
if (!TAP) {
errs() << ProgName
<< ": error: this target does not support assembly parsing.\n";
@@ -363,7 +362,7 @@ int main(int argc, char **argv) {
if (!TheTarget)
return 1;
- OwningPtr<MemoryBuffer> BufferPtr;
+ std::unique_ptr<MemoryBuffer> BufferPtr;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr)) {
errs() << ProgName << ": " << ec.message() << '\n';
return 1;
@@ -379,15 +378,15 @@ int main(int argc, char **argv) {
// it later.
SrcMgr.setIncludeDirs(IncludeDirs);
- llvm::OwningPtr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TripleName));
+ std::unique_ptr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TripleName));
assert(MRI && "Unable to create target register info!");
- llvm::OwningPtr<MCAsmInfo> MAI(TheTarget->createMCAsmInfo(*MRI, TripleName));
+ std::unique_ptr<MCAsmInfo> MAI(TheTarget->createMCAsmInfo(*MRI, TripleName));
assert(MAI && "Unable to create target asm info!");
// FIXME: This is not pretty. MCContext has a ptr to MCObjectFileInfo and
// MCObjectFileInfo needs a MCContext reference in order to initialize itself.
- OwningPtr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
+ std::unique_ptr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), &SrcMgr);
MOFI->InitMCObjectFileInfo(TripleName, RelocModel, CMModel, Ctx);
@@ -413,16 +412,16 @@ int main(int argc, char **argv) {
FeaturesStr = Features.getString();
}
- OwningPtr<tool_output_file> Out(GetOutputStream());
+ std::unique_ptr<tool_output_file> Out(GetOutputStream());
if (!Out)
return 1;
formatted_raw_ostream FOS(Out->os());
- OwningPtr<MCStreamer> Str;
+ std::unique_ptr<MCStreamer> Str;
- OwningPtr<MCInstrInfo> MCII(TheTarget->createMCInstrInfo());
- OwningPtr<MCSubtargetInfo>
- STI(TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));
+ std::unique_ptr<MCInstrInfo> MCII(TheTarget->createMCInstrInfo());
+ std::unique_ptr<MCSubtargetInfo> STI(
+ TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));
MCInstPrinter *IP = NULL;
if (FileType == OFT_AssemblyFile) {
diff --git a/tools/llvm-mcmarkup/llvm-mcmarkup.cpp b/tools/llvm-mcmarkup/llvm-mcmarkup.cpp
index 72a075c50d5..f3a3e45fdd3 100644
--- a/tools/llvm-mcmarkup/llvm-mcmarkup.cpp
+++ b/tools/llvm-mcmarkup/llvm-mcmarkup.cpp
@@ -11,7 +11,6 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/ManagedStatic.h"
@@ -136,7 +135,7 @@ MarkupTag MarkupParser::parseTag() {
}
static void parseMCMarkup(StringRef Filename) {
- OwningPtr<MemoryBuffer> BufferPtr;
+ std::unique_ptr<MemoryBuffer> BufferPtr;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename, BufferPtr)) {
errs() << ToolName << ": " << ec.message() << '\n';
return;
diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp
index 7053b363400..70c789f328c 100644
--- a/tools/llvm-nm/llvm-nm.cpp
+++ b/tools/llvm-nm/llvm-nm.cpp
@@ -518,7 +518,7 @@ static void dumpSymbolNamesFromObject(SymbolicFile *Obj) {
}
static void dumpSymbolNamesFromFile(std::string &Filename) {
- OwningPtr<MemoryBuffer> Buffer;
+ std::unique_ptr<MemoryBuffer> Buffer;
if (error(MemoryBuffer::getFileOrSTDIN(Filename, Buffer), Filename))
return;
@@ -526,7 +526,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) {
ErrorOr<Binary *> BinaryOrErr = createBinary(Buffer.release(), &Context);
if (error(BinaryOrErr.getError(), Filename))
return;
- OwningPtr<Binary> Bin(BinaryOrErr.get());
+ std::unique_ptr<Binary> Bin(BinaryOrErr.get());
if (Archive *A = dyn_cast<Archive>(Bin.get())) {
if (ArchiveMap) {
@@ -552,7 +552,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) {
for (Archive::child_iterator I = A->child_begin(), E = A->child_end();
I != E; ++I) {
- OwningPtr<Binary> Child;
+ std::unique_ptr<Binary> Child;
if (I->getAsBinary(Child, &Context))
continue;
if (SymbolicFile *O = dyn_cast<SymbolicFile>(Child.get())) {
@@ -566,7 +566,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) {
for (MachOUniversalBinary::object_iterator I = UB->begin_objects(),
E = UB->end_objects();
I != E; ++I) {
- OwningPtr<ObjectFile> Obj;
+ std::unique_ptr<ObjectFile> Obj;
if (!I->getAsObjectFile(Obj)) {
outs() << Obj->getFileName() << ":\n";
dumpSymbolNamesFromObject(Obj.get());
diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp
index d67b3c63ad8..df96f00bd7b 100644
--- a/tools/llvm-objdump/MachODump.cpp
+++ b/tools/llvm-objdump/MachODump.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "llvm-objdump.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Triple.h"
@@ -201,14 +200,14 @@ static void DisassembleInputMachO2(StringRef Filename,
MachOObjectFile *MachOOF);
void llvm::DisassembleInputMachO(StringRef Filename) {
- OwningPtr<MemoryBuffer> Buff;
+ std::unique_ptr<MemoryBuffer> Buff;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename, Buff)) {
errs() << "llvm-objdump: " << Filename << ": " << ec.message() << "\n";
return;
}
- OwningPtr<MachOObjectFile> MachOOF(static_cast<MachOObjectFile *>(
+ std::unique_ptr<MachOObjectFile> MachOOF(static_cast<MachOObjectFile *>(
ObjectFile::createMachOObjectFile(Buff.release()).get()));
DisassembleInputMachO2(Filename, MachOOF.get());
@@ -221,21 +220,22 @@ static void DisassembleInputMachO2(StringRef Filename,
// GetTarget prints out stuff.
return;
}
- OwningPtr<const MCInstrInfo> InstrInfo(TheTarget->createMCInstrInfo());
- OwningPtr<MCInstrAnalysis>
- InstrAnalysis(TheTarget->createMCInstrAnalysis(InstrInfo.get()));
+ std::unique_ptr<const MCInstrInfo> InstrInfo(TheTarget->createMCInstrInfo());
+ std::unique_ptr<MCInstrAnalysis> InstrAnalysis(
+ TheTarget->createMCInstrAnalysis(InstrInfo.get()));
// Set up disassembler.
- OwningPtr<const MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TripleName));
- OwningPtr<const MCAsmInfo> AsmInfo(
+ std::unique_ptr<const MCRegisterInfo> MRI(
+ TheTarget->createMCRegInfo(TripleName));
+ std::unique_ptr<const MCAsmInfo> AsmInfo(
TheTarget->createMCAsmInfo(*MRI, TripleName));
- OwningPtr<const MCSubtargetInfo>
- STI(TheTarget->createMCSubtargetInfo(TripleName, "", ""));
- OwningPtr<const MCDisassembler> DisAsm(TheTarget->createMCDisassembler(*STI));
+ std::unique_ptr<const MCSubtargetInfo> STI(
+ TheTarget->createMCSubtargetInfo(TripleName, "", ""));
+ std::unique_ptr<const MCDisassembler> DisAsm(
+ TheTarget->createMCDisassembler(*STI));
int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
- OwningPtr<MCInstPrinter>
- IP(TheTarget->createMCInstPrinter(AsmPrinterVariant, *AsmInfo, *InstrInfo,
- *MRI, *STI));
+ std::unique_ptr<MCInstPrinter> IP(TheTarget->createMCInstPrinter(
+ AsmPrinterVariant, *AsmInfo, *InstrInfo, *MRI, *STI));
if (!InstrAnalysis || !AsmInfo || !STI || !DisAsm || !IP) {
errs() << "error: couldn't initialize disassembler for target "
@@ -285,14 +285,14 @@ static void DisassembleInputMachO2(StringRef Filename,
raw_ostream &DebugOut = nulls();
#endif
- OwningPtr<DIContext> diContext;
+ std::unique_ptr<DIContext> diContext;
ObjectFile *DbgObj = MachOOF;
// Try to find debug info and set up the DIContext for it.
if (UseDbg) {
// A separate DSym file path was specified, parse it as a macho file,
// get the sections and supply it to the section name parsing machinery.
if (!DSYMFile.empty()) {
- OwningPtr<MemoryBuffer> Buf;
+ std::unique_ptr<MemoryBuffer> Buf;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(DSYMFile, Buf)) {
errs() << "llvm-objdump: " << Filename << ": " << ec.message() << '\n';
return;
diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp
index d8460fdb247..7a3d0e29d96 100644
--- a/tools/llvm-objdump/llvm-objdump.cpp
+++ b/tools/llvm-objdump/llvm-objdump.cpp
@@ -17,7 +17,6 @@
//===----------------------------------------------------------------------===//
#include "llvm-objdump.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Triple.h"
@@ -282,60 +281,61 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
FeaturesStr = Features.getString();
}
- OwningPtr<const MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TripleName));
+ std::unique_ptr<const MCRegisterInfo> MRI(
+ TheTarget->createMCRegInfo(TripleName));
if (!MRI) {
errs() << "error: no register info for target " << TripleName << "\n";
return;
}
// Set up disassembler.
- OwningPtr<const MCAsmInfo> AsmInfo(
- TheTarget->createMCAsmInfo(*MRI, TripleName));
+ std::unique_ptr<const MCAsmInfo> AsmInfo(
+ TheTarget->createMCAsmInfo(*MRI, TripleName));
if (!AsmInfo) {
errs() << "error: no assembly info for target " << TripleName << "\n";
return;
}
- OwningPtr<const MCSubtargetInfo> STI(
- TheTarget->createMCSubtargetInfo(TripleName, "", FeaturesStr));
+ std::unique_ptr<const MCSubtargetInfo> STI(
+ TheTarget->createMCSubtargetInfo(TripleName, "", FeaturesStr));
if (!STI) {
errs() << "error: no subtarget info for target " << TripleName << "\n";
return;
}
- OwningPtr<const MCInstrInfo> MII(TheTarget->createMCInstrInfo());
+ std::unique_ptr<const MCInstrInfo> MII(TheTarget->createMCInstrInfo());
if (!MII) {
errs() << "error: no instruction info for target " << TripleName << "\n";
return;
}
- OwningPtr<MCDisassembler> DisAsm(TheTarget->createMCDisassembler(*STI));
+ std::unique_ptr<MCDisassembler> DisAsm(TheTarget->createMCDisassembler(*STI));
if (!DisAsm) {
errs() << "error: no disassembler for target " << TripleName << "\n";
return;
}
- OwningPtr<const MCObjectFileInfo> MOFI;
- OwningPtr<MCContext> Ctx;
+ std::unique_ptr<const MCObjectFileInfo> MOFI;
+ std::unique_ptr<MCContext> Ctx;
if (Symbolize) {
MOFI.reset(new MCObjectFileInfo);
Ctx.reset(new MCContext(AsmInfo.get(), MRI.get(), MOFI.get()));
- OwningPtr<MCRelocationInfo> RelInfo(
- TheTarget->createMCRelocationInfo(TripleName, *Ctx.get()));
+ std::unique_ptr<MCRelocationInfo> RelInfo(
+ TheTarget->createMCRelocationInfo(TripleName, *Ctx.get()));
if (RelInfo) {
- OwningPtr<MCSymbolizer> Symzer(
- MCObjectSymbolizer::createObjectSymbolizer(*Ctx.get(), RelInfo, Obj));
+ std::unique_ptr<MCSymbolizer> Symzer(
+ MCObjectSymbolizer::createObjectSymbolizer(*Ctx.get(), RelInfo, Obj));
if (Symzer)
DisAsm->setSymbolizer(Symzer);
}
}
- OwningPtr<const MCInstrAnalysis>
- MIA(TheTarget->createMCInstrAnalysis(MII.get()));
+ std::unique_ptr<const MCInstrAnalysis> MIA(
+ TheTarget->createMCInstrAnalysis(MII.get()));
int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
- OwningPtr<MCInstPrinter> IP(TheTarget->createMCInstPrinter(
+ std::unique_ptr<MCInstPrinter> IP(TheTarget->createMCInstPrinter(
AsmPrinterVariant, *AsmInfo, *MII, *MRI, *STI));
if (!IP) {
errs() << "error: no instruction printer for target " << TripleName
@@ -344,9 +344,9 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
}
if (CFG || !YAMLCFG.empty()) {
- OwningPtr<MCObjectDisassembler> OD(
- new MCObjectDisassembler(*Obj, *DisAsm, *MIA));
- OwningPtr<MCModule> Mod(OD->buildModule(/* withCFG */ true));
+ std::unique_ptr<MCObjectDisassembler> OD(
+ new MCObjectDisassembler(*Obj, *DisAsm, *MIA));
+ std::unique_ptr<MCModule> Mod(OD->buildModule(/* withCFG */ true));
for (MCModule::const_atom_iterator AI = Mod->atom_begin(),
AE = Mod->atom_end();
AI != AE; ++AI) {
@@ -814,7 +814,7 @@ static void DumpObject(const ObjectFile *o) {
static void DumpArchive(const Archive *a) {
for (Archive::child_iterator i = a->child_begin(), e = a->child_end(); i != e;
++i) {
- OwningPtr<Binary> child;
+ std::unique_ptr<Binary> child;
if (error_code EC = i->getAsBinary(child)) {
// Ignore non-object files.
if (EC != object_error::invalid_file_type)
@@ -849,7 +849,7 @@ static void DumpInput(StringRef file) {
errs() << ToolName << ": '" << file << "': " << EC.message() << ".\n";
return;
}
- OwningPtr<Binary> binary(BinaryOrErr.get());
+ std::unique_ptr<Binary> binary(BinaryOrErr.get());
if (Archive *a = dyn_cast<Archive>(binary.get()))
DumpArchive(a);
diff --git a/tools/llvm-profdata/llvm-profdata.cpp b/tools/llvm-profdata/llvm-profdata.cpp
index 236780b4853..b338efd27e3 100644
--- a/tools/llvm-profdata/llvm-profdata.cpp
+++ b/tools/llvm-profdata/llvm-profdata.cpp
@@ -11,7 +11,6 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
@@ -101,8 +100,8 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, "LLVM profile data merger\n");
- OwningPtr<MemoryBuffer> File1;
- OwningPtr<MemoryBuffer> File2;
+ std::unique_ptr<MemoryBuffer> File1;
+ std::unique_ptr<MemoryBuffer> File2;
if (error_code ec = MemoryBuffer::getFile(Filename1, File1))
exitWithError(ec.message(), Filename1);
if (error_code ec = MemoryBuffer::getFile(Filename2, File2))
diff --git a/tools/llvm-readobj/COFFDumper.cpp b/tools/llvm-readobj/COFFDumper.cpp
index 2c8afdfbb79..c33af18fe99 100644
--- a/tools/llvm-readobj/COFFDumper.cpp
+++ b/tools/llvm-readobj/COFFDumper.cpp
@@ -104,9 +104,8 @@ private:
namespace llvm {
-error_code createCOFFDumper(const object::ObjectFile *Obj,
- StreamWriter& Writer,
- OwningPtr<ObjDumper> &Result) {
+error_code createCOFFDumper(const object::ObjectFile *Obj, StreamWriter &Writer,
+ std::unique_ptr<ObjDumper> &Result) {
const COFFObjectFile *COFFObj = dyn_cast<COFFObjectFile>(Obj);
if (!COFFObj)
return readobj_error::unsupported_obj_file_format;
diff --git a/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp
index adab38fef62..cc51089afde 100644
--- a/tools/llvm-readobj/ELFDumper.cpp
+++ b/tools/llvm-readobj/ELFDumper.cpp
@@ -83,14 +83,13 @@ namespace llvm {
template <class ELFT>
static error_code createELFDumper(const ELFFile<ELFT> *Obj,
StreamWriter &Writer,
- OwningPtr<ObjDumper> &Result) {
+ std::unique_ptr<ObjDumper> &Result) {
Result.reset(new ELFDumper<ELFT>(Obj, Writer));
return readobj_error::success;
}
-error_code createELFDumper(const object::ObjectFile *Obj,
- StreamWriter& Writer,
- OwningPtr<ObjDumper> &Result) {
+error_code createELFDumper(const object::ObjectFile *Obj, StreamWriter &Writer,
+ std::unique_ptr<ObjDumper> &Result) {
// Little-endian 32-bit
if (const ELF32LEObjectFile *ELFObj = dyn_cast<ELF32LEObjectFile>(Obj))
return createELFDumper(ELFObj->getELFFile(), Writer, Result);
diff --git a/tools/llvm-readobj/MachODumper.cpp b/tools/llvm-readobj/MachODumper.cpp
index 6ff817c25ca..1631777423e 100644
--- a/tools/llvm-readobj/MachODumper.cpp
+++ b/tools/llvm-readobj/MachODumper.cpp
@@ -56,8 +56,8 @@ private:
namespace llvm {
error_code createMachODumper(const object::ObjectFile *Obj,
- StreamWriter& Writer,
- OwningPtr<ObjDumper> &Result) {
+ StreamWriter &Writer,
+ std::unique_ptr<ObjDumper> &Result) {
const MachOObjectFile *MachOObj = dyn_cast<MachOObjectFile>(Obj);
if (!MachOObj)
return readobj_error::unsupported_obj_file_format;
diff --git a/tools/llvm-readobj/ObjDumper.h b/tools/llvm-readobj/ObjDumper.h
index 64bab056321..9e0fd2f990a 100644
--- a/tools/llvm-readobj/ObjDumper.h
+++ b/tools/llvm-readobj/ObjDumper.h
@@ -10,6 +10,8 @@
#ifndef LLVM_READOBJ_OBJDUMPER_H
#define LLVM_READOBJ_OBJDUMPER_H
+#include <memory>
+
namespace llvm {
namespace object {
@@ -18,9 +20,6 @@ namespace object {
class error_code;
-template<typename T>
-class OwningPtr;
-
class StreamWriter;
class ObjDumper {
@@ -47,17 +46,15 @@ protected:
StreamWriter& W;
};
-error_code createCOFFDumper(const object::ObjectFile *Obj,
- StreamWriter& Writer,
- OwningPtr<ObjDumper> &Result);
+error_code createCOFFDumper(const object::ObjectFile *Obj, StreamWriter &Writer,
+ std::unique_ptr<ObjDumper> &Result);
-error_code createELFDumper(const object::ObjectFile *Obj,
- StreamWriter& Writer,
- OwningPtr<ObjDumper> &Result);
+error_code createELFDumper(const object::ObjectFile *Obj, StreamWriter &Writer,
+ std::unique_ptr<ObjDumper> &Result);
error_code createMachODumper(const object::ObjectFile *Obj,
- StreamWriter& Writer,
- OwningPtr<ObjDumper> &Result);
+ StreamWriter &Writer,
+ std::unique_ptr<ObjDumper> &Result);
} // namespace llvm
diff --git a/tools/llvm-readobj/llvm-readobj.cpp b/tools/llvm-readobj/llvm-readobj.cpp
index 56f60114fe0..5be959f85c1 100644
--- a/tools/llvm-readobj/llvm-readobj.cpp
+++ b/tools/llvm-readobj/llvm-readobj.cpp
@@ -179,9 +179,8 @@ static void reportError(StringRef Input, StringRef Message) {
}
/// @brief Creates an format-specific object file dumper.
-static error_code createDumper(const ObjectFile *Obj,
- StreamWriter &Writer,
- OwningPtr<ObjDumper> &Result) {
+static error_code createDumper(const ObjectFile *Obj, StreamWriter &Writer,
+ std::unique_ptr<ObjDumper> &Result) {
if (!Obj)
return readobj_error::unsupported_file_format;
@@ -199,7 +198,7 @@ static error_code createDumper(const ObjectFile *Obj,
/// @brief Dumps the specified object file.
static void dumpObject(const ObjectFile *Obj) {
StreamWriter Writer(outs());
- OwningPtr<ObjDumper> Dumper;
+ std::unique_ptr<ObjDumper> Dumper;
if (error_code EC = createDumper(Obj, Writer, Dumper)) {
reportError(Obj->getFileName(), EC);
return;
@@ -244,7 +243,7 @@ static void dumpArchive(const Archive *Arc) {
for (Archive::child_iterator ArcI = Arc->child_begin(),
ArcE = Arc->child_end();
ArcI != ArcE; ++ArcI) {
- OwningPtr<Binary> child;
+ std::unique_ptr<Binary> child;
if (error_code EC = ArcI->getAsBinary(child)) {
// Ignore non-object files.
if (EC != object_error::invalid_file_type)
@@ -274,7 +273,7 @@ static void dumpInput(StringRef File) {
reportError(File, EC);
return;
}
- OwningPtr<Binary> Binary(BinaryOrErr.get());
+ std::unique_ptr<Binary> Binary(BinaryOrErr.get());
if (Archive *Arc = dyn_cast<Archive>(Binary.get()))
dumpArchive(Arc);
diff --git a/tools/llvm-rtdyld/llvm-rtdyld.cpp b/tools/llvm-rtdyld/llvm-rtdyld.cpp
index d9e640fc353..ffac5dce829 100644
--- a/tools/llvm-rtdyld/llvm-rtdyld.cpp
+++ b/tools/llvm-rtdyld/llvm-rtdyld.cpp
@@ -11,7 +11,6 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/ExecutionEngine/ObjectBuffer.h"
@@ -133,8 +132,8 @@ static int printLineInfoForInput() {
RuntimeDyld Dyld(&MemMgr);
// Load the input memory buffer.
- OwningPtr<MemoryBuffer> InputBuffer;
- OwningPtr<ObjectImage> LoadedObject;
+ std::unique_ptr<MemoryBuffer> InputBuffer;
+ std::unique_ptr<ObjectImage> LoadedObject;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFileList[i],
InputBuffer))
return Error("unable to read input: '" + ec.message() + "'");
@@ -148,7 +147,8 @@ static int printLineInfoForInput() {
// Resolve all the relocations we can.
Dyld.resolveRelocations();
- OwningPtr<DIContext> Context(DIContext::getDWARFContext(LoadedObject->getObjectFile()));
+ std::unique_ptr<DIContext> Context(
+ DIContext::getDWARFContext(LoadedObject->getObjectFile()));
// Use symbol info to iterate functions in the object.
for (object::symbol_iterator I = LoadedObject->begin_symbols(),
@@ -191,8 +191,8 @@ static int executeInput() {
InputFileList.push_back("-");
for(unsigned i = 0, e = InputFileList.size(); i != e; ++i) {
// Load the input memory buffer.
- OwningPtr<MemoryBuffer> InputBuffer;
- OwningPtr<ObjectImage> LoadedObject;
+ std::unique_ptr<MemoryBuffer> InputBuffer;
+ std::unique_ptr<ObjectImage> LoadedObject;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFileList[i],
InputBuffer))
return Error("unable to read input: '" + ec.message() + "'");
diff --git a/tools/llvm-size/llvm-size.cpp b/tools/llvm-size/llvm-size.cpp
index c2d24462758..89528dc8b4e 100644
--- a/tools/llvm-size/llvm-size.cpp
+++ b/tools/llvm-size/llvm-size.cpp
@@ -236,13 +236,13 @@ static void PrintFileSectionSizes(StringRef file) {
errs() << ToolName << ": " << file << ": " << EC.message() << ".\n";
return;
}
- OwningPtr<Binary> binary(BinaryOrErr.get());
+ std::unique_ptr<Binary> binary(BinaryOrErr.get());
if (Archive *a = dyn_cast<Archive>(binary.get())) {
// This is an archive. Iterate over each member and display its sizes.
for (object::Archive::child_iterator i = a->child_begin(),
e = a->child_end(); i != e; ++i) {
- OwningPtr<Binary> child;
+ std::unique_ptr<Binary> child;
if (error_code ec = i->getAsBinary(child)) {
errs() << ToolName << ": " << file << ": " << ec.message() << ".\n";
continue;
diff --git a/tools/llvm-stress/llvm-stress.cpp b/tools/llvm-stress/llvm-stress.cpp
index d31b86f56bd..6afcae43f97 100644
--- a/tools/llvm-stress/llvm-stress.cpp
+++ b/tools/llvm-stress/llvm-stress.cpp
@@ -11,7 +11,7 @@
// different components in LLVM.
//
//===----------------------------------------------------------------------===//
-#include "llvm/ADT/OwningPtr.h"
+
#include "llvm/Analysis/CallGraphSCCPass.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/IRPrintingPasses.h"
@@ -625,15 +625,15 @@ static void FillFunction(Function *F, Random &R) {
// List of modifiers which add new random instructions.
std::vector<Modifier*> Modifiers;
- OwningPtr<Modifier> LM(new LoadModifier(BB, &PT, &R));
- OwningPtr<Modifier> SM(new StoreModifier(BB, &PT, &R));
- OwningPtr<Modifier> EE(new ExtractElementModifier(BB, &PT, &R));
- OwningPtr<Modifier> SHM(new ShuffModifier(BB, &PT, &R));
- OwningPtr<Modifier> IE(new InsertElementModifier(BB, &PT, &R));
- OwningPtr<Modifier> BM(new BinModifier(BB, &PT, &R));
- OwningPtr<Modifier> CM(new CastModifier(BB, &PT, &R));
- OwningPtr<Modifier> SLM(new SelectModifier(BB, &PT, &R));
- OwningPtr<Modifier> PM(new CmpModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> LM(new LoadModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> SM(new StoreModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> EE(new ExtractElementModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> SHM(new ShuffModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> IE(new InsertElementModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> BM(new BinModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> CM(new CastModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> SLM(new SelectModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> PM(new CmpModifier(BB, &PT, &R));
Modifiers.push_back(LM.get());
Modifiers.push_back(SM.get());
Modifiers.push_back(EE.get());
@@ -687,7 +687,7 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, "llvm codegen stress-tester\n");
llvm_shutdown_obj Y;
- OwningPtr<Module> M(new Module("/tmp/autogen.bc", getGlobalContext()));
+ std::unique_ptr<Module> M(new Module("/tmp/autogen.bc", getGlobalContext()));
Function *F = GenEmptyFunction(M.get());
// Pick an initial seed value
@@ -698,7 +698,7 @@ int main(int argc, char **argv) {
IntroduceControlFlow(F, R);
// Figure out what stream we are supposed to write to...
- OwningPtr<tool_output_file> Out;
+ std::unique_ptr<tool_output_file> Out;
// Default to standard output.
if (OutputFilename.empty())
OutputFilename = "-";
diff --git a/tools/llvm-symbolizer/LLVMSymbolize.cpp b/tools/llvm-symbolizer/LLVMSymbolize.cpp
index 91abe46e095..31b6c68c8ae 100644
--- a/tools/llvm-symbolizer/LLVMSymbolize.cpp
+++ b/tools/llvm-symbolizer/LLVMSymbolize.cpp
@@ -231,7 +231,7 @@ static std::string getDarwinDWARFResourceForPath(const std::string &Path) {
}
static bool checkFileCRC(StringRef Path, uint32_t CRCHash) {
- OwningPtr<MemoryBuffer> MB;
+ std::unique_ptr<MemoryBuffer> MB;
if (MemoryBuffer::getFileOrSTDIN(Path, MB))
return false;
return !zlib::isAvailable() || CRCHash == zlib::crc32(MB->getBuffer());
@@ -313,7 +313,7 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
Binary *DbgBin = 0;
ErrorOr<Binary *> BinaryOrErr = createBinary(Path);
if (!error(BinaryOrErr.getError())) {
- OwningPtr<Binary> ParsedBinary(BinaryOrErr.get());
+ std::unique_ptr<Binary> ParsedBinary(BinaryOrErr.get());
// Check if it's a universal binary.
Bin = ParsedBinary.release();
ParsedBinariesAndObjects.push_back(Bin);
@@ -361,7 +361,7 @@ LLVMSymbolizer::getObjectFileFromBinary(Binary *Bin, const std::string &ArchName
std::make_pair(UB, ArchName));
if (I != ObjectFileForArch.end())
return I->second;
- OwningPtr<ObjectFile> ParsedObj;
+ std::unique_ptr<ObjectFile> ParsedObj;
if (!UB->getObjectForArch(Triple(ArchName).getArch(), ParsedObj)) {
Res = ParsedObj.release();
ParsedBinariesAndObjects.push_back(Res);
diff --git a/tools/llvm-symbolizer/LLVMSymbolize.h b/tools/llvm-symbolizer/LLVMSymbolize.h
index 4ad3e97306d..53fd8183786 100644
--- a/tools/llvm-symbolizer/LLVMSymbolize.h
+++ b/tools/llvm-symbolizer/LLVMSymbolize.h
@@ -13,7 +13,6 @@
#ifndef LLVM_SYMBOLIZE_H
#define LLVM_SYMBOLIZE_H
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/Object/MachOUniversal.h"
@@ -104,7 +103,7 @@ private:
uint64_t &Size) const;
void addSymbol(const symbol_iterator &Sym);
ObjectFile *Module;
- OwningPtr<DIContext> DebugInfoContext;
+ std::unique_ptr<DIContext> DebugInfoContext;
struct SymbolDesc {
uint64_t Addr;
diff --git a/tools/macho-dump/macho-dump.cpp b/tools/macho-dump/macho-dump.cpp
index dbb2700b77e..9cfbdfb1b18 100644
--- a/tools/macho-dump/macho-dump.cpp
+++ b/tools/macho-dump/macho-dump.cpp
@@ -381,7 +381,7 @@ int main(int argc, char **argv) {
ErrorOr<Binary *> BinaryOrErr = createBinary(InputFile);
if (error_code EC = BinaryOrErr.getError())
return Error("unable to read input: '" + EC.message() + "'");
- OwningPtr<Binary> Binary(BinaryOrErr.get());
+ std::unique_ptr<Binary> Binary(BinaryOrErr.get());
const MachOObjectFile *InputObject = dyn_cast<MachOObjectFile>(Binary.get());
if (!InputObject)
diff --git a/tools/obj2yaml/obj2yaml.cpp b/tools/obj2yaml/obj2yaml.cpp
index d675f59cf48..38779fe4565 100644
--- a/tools/obj2yaml/obj2yaml.cpp
+++ b/tools/obj2yaml/obj2yaml.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
#include "obj2yaml.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/COFF.h"
#include "llvm/Support/CommandLine.h"
@@ -38,7 +37,7 @@ int main(int argc, char *argv[]) {
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
// Process the input file
- OwningPtr<MemoryBuffer> buf;
+ std::unique_ptr<MemoryBuffer> buf;
// TODO: If this is an archive, then burst it and dump each entry
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, buf)) {
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 1501bde219c..14a40a4af76 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -356,7 +356,7 @@ int main(int argc, char **argv) {
SMDiagnostic Err;
// Load the input module...
- OwningPtr<Module> M;
+ std::unique_ptr<Module> M;
M.reset(ParseIRFile(InputFilename, Err, Context));
if (M.get() == 0) {
@@ -369,7 +369,7 @@ int main(int argc, char **argv) {
M->setTargetTriple(Triple::normalize(TargetTriple));
// Figure out what stream we are supposed to write to...
- OwningPtr<tool_output_file> Out;
+ std::unique_ptr<tool_output_file> Out;
if (NoOutput) {
if (!OutputFilename.empty())
errs() << "WARNING: The -o (output filename) option is ignored when\n"
@@ -442,13 +442,13 @@ int main(int argc, char **argv) {
TargetMachine *Machine = 0;
if (ModuleTriple.getArch())
Machine = GetTargetMachine(Triple(ModuleTriple));
- OwningPtr<TargetMachine> TM(Machine);
+ std::unique_ptr<TargetMachine> TM(Machine);
// Add internal analysis passes from the target machine.
if (TM.get())
TM->addAnalysisPasses(Passes);
- OwningPtr<FunctionPassManager> FPasses;
+ std::unique_ptr<FunctionPassManager> FPasses;
if (OptLevelO1 || OptLevelO2 || OptLevelOs || OptLevelOz || OptLevelO3) {
FPasses.reset(new FunctionPassManager(M.get()));
if (DL)
diff --git a/tools/yaml2obj/yaml2obj.cpp b/tools/yaml2obj/yaml2obj.cpp
index 6d1107c8581..cc0fecc3c63 100644
--- a/tools/yaml2obj/yaml2obj.cpp
+++ b/tools/yaml2obj/yaml2obj.cpp
@@ -15,7 +15,6 @@
//===----------------------------------------------------------------------===//
#include "yaml2obj.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -57,7 +56,7 @@ int main(int argc, char **argv) {
PrettyStackTraceProgram X(argc, argv);
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
- OwningPtr<MemoryBuffer> Buf;
+ std::unique_ptr<MemoryBuffer> Buf;
if (MemoryBuffer::getFileOrSTDIN(Input, Buf))
return 1;
if (Format == YOF_COFF) {