From 200241e4de11981523b3d14f3acab6129efed701 Mon Sep 17 00:00:00 2001 From: Andy Gibbs Date: Fri, 12 Apr 2013 10:56:28 +0000 Subject: Replace uses of the deprecated std::auto_ptr with OwningPtr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179373 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/bugpoint/BugDriver.cpp | 2 +- tools/llc/llc.cpp | 4 ++-- tools/llvm-as/llvm-as.cpp | 2 +- tools/llvm-dis/llvm-dis.cpp | 2 +- tools/llvm-extract/llvm-extract.cpp | 2 +- tools/llvm-link/llvm-link.cpp | 19 +++++++++---------- tools/llvm-ranlib/llvm-ranlib.cpp | 2 +- tools/opt/opt.cpp | 4 ++-- 8 files changed, 18 insertions(+), 19 deletions(-) (limited to 'tools') diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp index e49a96b1e0..937d86a5b8 100644 --- a/tools/bugpoint/BugDriver.cpp +++ b/tools/bugpoint/BugDriver.cpp @@ -122,7 +122,7 @@ bool BugDriver::addSources(const std::vector &Filenames) { outs() << "Read input file : '" << Filenames[0] << "'\n"; for (unsigned i = 1, e = Filenames.size(); i != e; ++i) { - std::auto_ptr M(ParseInputFile(Filenames[i], Context)); + OwningPtr M(ParseInputFile(Filenames[i], Context)); if (M.get() == 0) return true; outs() << "Linking in input file: '" << Filenames[i] << "'\n"; diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index 1dce9d7b60..8a462c608a 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -200,7 +200,7 @@ int main(int argc, char **argv) { static int compileModule(char **argv, LLVMContext &Context) { // Load the module to be compiled... SMDiagnostic Err; - std::auto_ptr M; + OwningPtr M; Module *mod = 0; Triple TheTriple; @@ -281,7 +281,7 @@ static int compileModule(char **argv, LLVMContext &Context) { Options.UseInitArray = UseInitArray; Options.SSPBufferSize = SSPBufferSize; - std::auto_ptr + OwningPtr target(TheTarget->createTargetMachine(TheTriple.getTriple(), MCPU, FeaturesStr, Options, RelocModel, CMModel, OLvl)); diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index 273c4274b5..d6f191961d 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -94,7 +94,7 @@ int main(int argc, char **argv) { // Parse the file now... SMDiagnostic Err; - std::auto_ptr M(ParseAssemblyFile(InputFilename, Err, Context)); + OwningPtr M(ParseAssemblyFile(InputFilename, Err, Context)); if (M.get() == 0) { Err.print(argv[0], errs()); return 1; diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp index 2baa91da50..067955e5cc 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; - std::auto_ptr M; + OwningPtr M; // Use the bitcode streaming interface DataStreamer *streamer = getDataFileStreamer(InputFilename, &ErrorMessage); diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp index fd0a381807..2f45b4eae5 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; - std::auto_ptr M; + OwningPtr M; M.reset(getLazyIRFileModule(InputFilename, Err, Context)); if (M.get() == 0) { diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp index 83665cc175..b195ca88de 100644 --- a/tools/llvm-link/llvm-link.cpp +++ b/tools/llvm-link/llvm-link.cpp @@ -53,13 +53,13 @@ DumpAsm("d", cl::desc("Print assembly as linked"), cl::Hidden); // LoadFile - Read the specified bitcode file in and return it. This routine // searches the link path for the specified file to try to find it... // -static inline std::auto_ptr LoadFile(const char *argv0, - const std::string &FN, - LLVMContext& Context) { +static inline OwningPtr LoadFile(const char *argv0, + const std::string &FN, + LLVMContext& Context) { sys::Path Filename; if (!Filename.set(FN)) { errs() << "Invalid file name: '" << FN << "'\n"; - return std::auto_ptr(); + return OwningPtr(); } SMDiagnostic Err; @@ -68,10 +68,10 @@ static inline std::auto_ptr LoadFile(const char *argv0, const std::string &FNStr = Filename.str(); Result = ParseIRFile(FNStr, Err, Context); - if (Result) return std::auto_ptr(Result); // Load successful! + if (Result) return OwningPtr(Result); // Load successful! Err.print(argv0, errs()); - return std::auto_ptr(); + return OwningPtr(); } int main(int argc, char **argv) { @@ -86,8 +86,8 @@ int main(int argc, char **argv) { unsigned BaseArg = 0; std::string ErrorMessage; - std::auto_ptr Composite(LoadFile(argv[0], - InputFilenames[BaseArg], Context)); + OwningPtr Composite(LoadFile(argv[0], + InputFilenames[BaseArg], Context)); if (Composite.get() == 0) { errs() << argv[0] << ": error loading file '" << InputFilenames[BaseArg] << "'\n"; @@ -95,8 +95,7 @@ int main(int argc, char **argv) { } for (unsigned i = BaseArg+1; i < InputFilenames.size(); ++i) { - std::auto_ptr M(LoadFile(argv[0], - InputFilenames[i], Context)); + OwningPtr M(LoadFile(argv[0], InputFilenames[i], Context)); if (M.get() == 0) { errs() << argv[0] << ": error loading file '" < + OwningPtr AutoArchive(Archive::OpenAndLoad(ArchivePath, Context, &err_msg)); Archive* TheArchive = AutoArchive.get(); if (!TheArchive) { diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index ba82bded2b..e385d7f577 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -589,7 +589,7 @@ int main(int argc, char **argv) { SMDiagnostic Err; // Load the input module... - std::auto_ptr M; + OwningPtr M; M.reset(ParseIRFile(InputFilename, Err, Context)); if (M.get() == 0) { @@ -656,7 +656,7 @@ int main(int argc, char **argv) { TargetMachine *Machine = 0; if (ModuleTriple.getArch()) Machine = GetTargetMachine(Triple(ModuleTriple)); - std::auto_ptr TM(Machine); + OwningPtr TM(Machine); // Add internal analysis passes from the target machine. if (TM.get()) -- cgit v1.2.3-18-g5258