[llvm] r179373 - Replace uses of the deprecated std::auto_ptr with OwningPtr.
Alexander Potapenko
glider at google.com
Fri Apr 12 04:12:58 PDT 2013
Hi Andy,
This broke a number of our team's buildbots, see the error reports below:
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/lib/CodeGen/RegAllocPBQP.cpp:285:10:
error: calling a private constructor of class
'llvm::OwningPtr<llvm::PBQPRAProblem>'
return p;
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/include/llvm/ADT/OwningPtr.h:29:3:
note: implicitly declared private here
OwningPtr(OwningPtr const &) LLVM_DELETED_FUNCTION;
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/lib/CodeGen/RegAllocPBQP.cpp:320:32:
warning: C++98 requires an accessible copy constructor for class
'llvm::OwningPtr<llvm::PBQPRAProblem>' when binding a reference to a
temporary; was private [-Wbind-to-temporary-copy]
OwningPtr<PBQPRAProblem> p = PBQPBuilder::build(mf, lis, loopInfo, vregs);
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/include/llvm/ADT/OwningPtr.h:29:3:
note: implicitly declared private here
OwningPtr(OwningPtr const &) LLVM_DELETED_FUNCTION;
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/lib/CodeGen/RegAllocPBQP.cpp:320:32:
error: calling a private constructor of class
'llvm::OwningPtr<llvm::PBQPRAProblem>'
OwningPtr<PBQPRAProblem> p = PBQPBuilder::build(mf, lis, loopInfo, vregs);
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/include/llvm/ADT/OwningPtr.h:29:3:
note: implicitly declared private here
OwningPtr(OwningPtr const &) LLVM_DELETED_FUNCTION;
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/lib/CodeGen/RegAllocPBQP.cpp:394:10:
error: calling a private constructor of class
'llvm::OwningPtr<llvm::PBQPRAProblem>'
return p;
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/include/llvm/ADT/OwningPtr.h:29:3:
note: implicitly declared private here
OwningPtr(OwningPtr const &) LLVM_DELETED_FUNCTION;
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/lib/CodeGen/RegAllocPBQP.cpp:588:9:
warning: C++98 requires an accessible copy constructor for class
'llvm::OwningPtr<llvm::PBQPRAProblem>' when binding a reference to a
temporary; was private [-Wbind-to-temporary-copy]
builder->build(mf, lis, loopInfo, vregsToAlloc);
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/include/llvm/ADT/OwningPtr.h:29:3:
note: implicitly declared private here
OwningPtr(OwningPtr const &) LLVM_DELETED_FUNCTION;
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/lib/CodeGen/RegAllocPBQP.cpp:588:9:
error: calling a private constructor of class
'llvm::OwningPtr<llvm::PBQPRAProblem>'
builder->build(mf, lis, loopInfo, vregsToAlloc);
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/include/llvm/ADT/OwningPtr.h:29:3:
note: implicitly declared private here
OwningPtr(OwningPtr const &) LLVM_DELETED_FUNCTION;
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/lib/CodeGen/RegAllocPBQP.cpp:626:27:
warning: C++98 requires an accessible copy constructor for class
'llvm::OwningPtr<llvm::PBQPBuilder>' when binding a reference to a
temporary; was private [-Wbind-to-temporary-copy]
return new RegAllocPBQP(OwningPtr<PBQPBuilder>(builder.take()), customPassID);
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/include/llvm/ADT/OwningPtr.h:29:3:
note: implicitly declared private here
OwningPtr(OwningPtr const &) LLVM_DELETED_FUNCTION;
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/lib/CodeGen/RegAllocPBQP.cpp:626:27:
error: calling a private constructor of class
'llvm::OwningPtr<llvm::PBQPBuilder>'
return new RegAllocPBQP(OwningPtr<PBQPBuilder>(builder.take()), customPassID);
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/include/llvm/ADT/OwningPtr.h:29:3:
note: implicitly declared private here
OwningPtr(OwningPtr const &) LLVM_DELETED_FUNCTION;
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/lib/CodeGen/RegAllocPBQP.cpp:632:14:
warning: C++98 requires an accessible copy constructor for class
'llvm::OwningPtr<llvm::PBQPBuilder>' when binding a reference to a
temporary; was private [-Wbind-to-temporary-copy]
OwningPtr<PBQPBuilder>(new PBQPBuilderWithCoalescing()));
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/include/llvm/ADT/OwningPtr.h:29:3:
note: implicitly declared private here
OwningPtr(OwningPtr const &) LLVM_DELETED_FUNCTION;
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/lib/CodeGen/RegAllocPBQP.cpp:632:14:
error: calling a private constructor of class
'llvm::OwningPtr<llvm::PBQPBuilder>'
OwningPtr<PBQPBuilder>(new PBQPBuilderWithCoalescing()));
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/include/llvm/ADT/OwningPtr.h:29:3:
note: implicitly declared private here
OwningPtr(OwningPtr const &) LLVM_DELETED_FUNCTION;
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/lib/CodeGen/RegAllocPBQP.cpp:635:12:
warning: C++98 requires an accessible copy constructor for class
'llvm::OwningPtr<llvm::PBQPBuilder>' when binding a reference to a
temporary; was private [-Wbind-to-temporary-copy]
OwningPtr<PBQPBuilder>(new PBQPBuilder()));
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/include/llvm/ADT/OwningPtr.h:29:3:
note: implicitly declared private here
OwningPtr(OwningPtr const &) LLVM_DELETED_FUNCTION;
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/lib/CodeGen/RegAllocPBQP.cpp:635:12:
error: calling a private constructor of class
'llvm::OwningPtr<llvm::PBQPBuilder>'
OwningPtr<PBQPBuilder>(new PBQPBuilder()));
^
/Users/buildbot/src/llvm-buildbot/slave/mac10.8/build/llvm/include/llvm/ADT/OwningPtr.h:29:3:
note: implicitly declared private here
OwningPtr(OwningPtr const &) LLVM_DELETED_FUNCTION;
^
5 warnings and 7 errors generated.
On Fri, Apr 12, 2013 at 2:56 PM, Andy Gibbs <andyg1001 at hotmail.co.uk> wrote:
> Author: andyg
> Date: Fri Apr 12 05:56:28 2013
> New Revision: 179373
>
> URL: http://llvm.org/viewvc/llvm-project?rev=179373&view=rev
> Log:
> Replace uses of the deprecated std::auto_ptr with OwningPtr.
>
> Modified:
> llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h
> llvm/trunk/lib/CodeGen/RegAllocBasic.cpp
> llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp
> llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
> llvm/trunk/tools/bugpoint/BugDriver.cpp
> llvm/trunk/tools/llc/llc.cpp
> llvm/trunk/tools/llvm-as/llvm-as.cpp
> llvm/trunk/tools/llvm-dis/llvm-dis.cpp
> llvm/trunk/tools/llvm-extract/llvm-extract.cpp
> llvm/trunk/tools/llvm-link/llvm-link.cpp
> llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp
> llvm/trunk/tools/opt/opt.cpp
>
> Modified: llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h?rev=179373&r1=179372&r2=179373&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h Fri Apr 12 05:56:28 2013
> @@ -17,6 +17,7 @@
> #define LLVM_CODEGEN_REGALLOCPBQP_H
>
> #include "llvm/ADT/DenseMap.h"
> +#include "llvm/ADT/OwningPtr.h"
> #include "llvm/CodeGen/MachineFunctionPass.h"
> #include "llvm/CodeGen/PBQP/Graph.h"
> #include "llvm/CodeGen/PBQP/Solution.h"
> @@ -123,11 +124,10 @@ namespace llvm {
>
> /// Build a PBQP instance to represent the register allocation problem for
> /// the given MachineFunction.
> - virtual std::auto_ptr<PBQPRAProblem> build(
> - MachineFunction *mf,
> - const LiveIntervals *lis,
> - const MachineLoopInfo *loopInfo,
> - const RegSet &vregs);
> + virtual OwningPtr<PBQPRAProblem> build(MachineFunction *mf,
> + const LiveIntervals *lis,
> + const MachineLoopInfo *loopInfo,
> + const RegSet &vregs);
> private:
>
> void addSpillCosts(PBQP::Vector &costVec, PBQP::PBQPNum spillCost);
> @@ -144,11 +144,10 @@ namespace llvm {
>
> /// Build a PBQP instance to represent the register allocation problem for
> /// the given MachineFunction.
> - virtual std::auto_ptr<PBQPRAProblem> build(
> - MachineFunction *mf,
> - const LiveIntervals *lis,
> - const MachineLoopInfo *loopInfo,
> - const RegSet &vregs);
> + virtual OwningPtr<PBQPRAProblem> build(MachineFunction *mf,
> + const LiveIntervals *lis,
> + const MachineLoopInfo *loopInfo,
> + const RegSet &vregs);
>
> private:
>
> @@ -161,7 +160,7 @@ namespace llvm {
> PBQP::PBQPNum benefit);
> };
>
> - FunctionPass* createPBQPRegisterAllocator(std::auto_ptr<PBQPBuilder> builder,
> + FunctionPass* createPBQPRegisterAllocator(OwningPtr<PBQPBuilder> builder,
> char *customPassID=0);
> }
>
>
> Modified: llvm/trunk/lib/CodeGen/RegAllocBasic.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocBasic.cpp?rev=179373&r1=179372&r2=179373&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/RegAllocBasic.cpp (original)
> +++ llvm/trunk/lib/CodeGen/RegAllocBasic.cpp Fri Apr 12 05:56:28 2013
> @@ -63,7 +63,7 @@ class RABasic : public MachineFunctionPa
> MachineFunction *MF;
>
> // state
> - std::auto_ptr<Spiller> SpillerInstance;
> + OwningPtr<Spiller> SpillerInstance;
> std::priority_queue<LiveInterval*, std::vector<LiveInterval*>,
> CompSpillWeight> Queue;
>
>
> Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=179373&r1=179372&r2=179373&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original)
> +++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Fri Apr 12 05:56:28 2013
> @@ -78,7 +78,7 @@ class RAGreedy : public MachineFunctionP
> LiveDebugVariables *DebugVars;
>
> // state
> - std::auto_ptr<Spiller> SpillerInstance;
> + OwningPtr<Spiller> SpillerInstance;
> std::priority_queue<std::pair<unsigned, unsigned> > Queue;
> unsigned NextCascade;
>
> @@ -166,8 +166,8 @@ class RAGreedy : public MachineFunctionP
> };
>
> // splitting state.
> - std::auto_ptr<SplitAnalysis> SA;
> - std::auto_ptr<SplitEditor> SE;
> + OwningPtr<SplitAnalysis> SA;
> + OwningPtr<SplitEditor> SE;
>
> /// Cached per-block interference maps
> InterferenceCache IntfCache;
>
> Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=179373&r1=179372&r2=179373&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original)
> +++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Fri Apr 12 05:56:28 2013
> @@ -89,8 +89,8 @@ public:
> static char ID;
>
> /// Construct a PBQP register allocator.
> - RegAllocPBQP(std::auto_ptr<PBQPBuilder> b, char *cPassID=0)
> - : MachineFunctionPass(ID), builder(b), customPassID(cPassID) {
> + RegAllocPBQP(OwningPtr<PBQPBuilder> b, char *cPassID=0)
> + : MachineFunctionPass(ID), builder(b.take()), customPassID(cPassID) {
> initializeSlotIndexesPass(*PassRegistry::getPassRegistry());
> initializeLiveIntervalsPass(*PassRegistry::getPassRegistry());
> initializeCalculateSpillWeightsPass(*PassRegistry::getPassRegistry());
> @@ -121,7 +121,7 @@ private:
> typedef std::set<unsigned> RegSet;
>
>
> - std::auto_ptr<PBQPBuilder> builder;
> + OwningPtr<PBQPBuilder> builder;
>
> char *customPassID;
>
> @@ -132,7 +132,7 @@ private:
> const MachineLoopInfo *loopInfo;
> MachineRegisterInfo *mri;
>
> - std::auto_ptr<Spiller> spiller;
> + OwningPtr<Spiller> spiller;
> LiveIntervals *lis;
> LiveStacks *lss;
> VirtRegMap *vrm;
> @@ -186,16 +186,16 @@ unsigned PBQPRAProblem::getPRegForOption
> return allowedSet[option - 1];
> }
>
> -std::auto_ptr<PBQPRAProblem> PBQPBuilder::build(MachineFunction *mf,
> - const LiveIntervals *lis,
> - const MachineLoopInfo *loopInfo,
> - const RegSet &vregs) {
> +OwningPtr<PBQPRAProblem> PBQPBuilder::build(MachineFunction *mf,
> + const LiveIntervals *lis,
> + const MachineLoopInfo *loopInfo,
> + const RegSet &vregs) {
>
> LiveIntervals *LIS = const_cast<LiveIntervals*>(lis);
> MachineRegisterInfo *mri = &mf->getRegInfo();
> const TargetRegisterInfo *tri = mf->getTarget().getRegisterInfo();
>
> - std::auto_ptr<PBQPRAProblem> p(new PBQPRAProblem());
> + OwningPtr<PBQPRAProblem> p(new PBQPRAProblem());
> PBQP::Graph &g = p->getGraph();
> RegSet pregs;
>
> @@ -311,13 +311,13 @@ void PBQPBuilder::addInterferenceCosts(
> }
> }
>
> -std::auto_ptr<PBQPRAProblem> PBQPBuilderWithCoalescing::build(
> +OwningPtr<PBQPRAProblem> PBQPBuilderWithCoalescing::build(
> MachineFunction *mf,
> const LiveIntervals *lis,
> const MachineLoopInfo *loopInfo,
> const RegSet &vregs) {
>
> - std::auto_ptr<PBQPRAProblem> p = PBQPBuilder::build(mf, lis, loopInfo, vregs);
> + OwningPtr<PBQPRAProblem> p = PBQPBuilder::build(mf, lis, loopInfo, vregs);
> PBQP::Graph &g = p->getGraph();
>
> const TargetMachine &tm = mf->getTarget();
> @@ -584,7 +584,7 @@ bool RegAllocPBQP::runOnMachineFunction(
> while (!pbqpAllocComplete) {
> DEBUG(dbgs() << " PBQP Regalloc round " << round << ":\n");
>
> - std::auto_ptr<PBQPRAProblem> problem =
> + OwningPtr<PBQPRAProblem> problem =
> builder->build(mf, lis, loopInfo, vregsToAlloc);
>
> #ifndef NDEBUG
> @@ -621,18 +621,18 @@ bool RegAllocPBQP::runOnMachineFunction(
> }
>
> FunctionPass* llvm::createPBQPRegisterAllocator(
> - std::auto_ptr<PBQPBuilder> builder,
> + OwningPtr<PBQPBuilder> builder,
> char *customPassID) {
> - return new RegAllocPBQP(builder, customPassID);
> + return new RegAllocPBQP(OwningPtr<PBQPBuilder>(builder.take()), customPassID);
> }
>
> FunctionPass* llvm::createDefaultPBQPRegisterAllocator() {
> if (pbqpCoalescing) {
> return createPBQPRegisterAllocator(
> - std::auto_ptr<PBQPBuilder>(new PBQPBuilderWithCoalescing()));
> + OwningPtr<PBQPBuilder>(new PBQPBuilderWithCoalescing()));
> } // else
> return createPBQPRegisterAllocator(
> - std::auto_ptr<PBQPBuilder>(new PBQPBuilder()));
> + OwningPtr<PBQPBuilder>(new PBQPBuilder()));
> }
>
> #undef DEBUG_TYPE
>
> Modified: llvm/trunk/tools/bugpoint/BugDriver.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/BugDriver.cpp?rev=179373&r1=179372&r2=179373&view=diff
> ==============================================================================
> --- llvm/trunk/tools/bugpoint/BugDriver.cpp (original)
> +++ llvm/trunk/tools/bugpoint/BugDriver.cpp Fri Apr 12 05:56:28 2013
> @@ -122,7 +122,7 @@ bool BugDriver::addSources(const std::ve
> outs() << "Read input file : '" << Filenames[0] << "'\n";
>
> for (unsigned i = 1, e = Filenames.size(); i != e; ++i) {
> - std::auto_ptr<Module> M(ParseInputFile(Filenames[i], Context));
> + OwningPtr<Module> M(ParseInputFile(Filenames[i], Context));
> if (M.get() == 0) return true;
>
> outs() << "Linking in input file: '" << Filenames[i] << "'\n";
>
> Modified: llvm/trunk/tools/llc/llc.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=179373&r1=179372&r2=179373&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llc/llc.cpp (original)
> +++ llvm/trunk/tools/llc/llc.cpp Fri Apr 12 05:56:28 2013
> @@ -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<Module> M;
> + OwningPtr<Module> M;
> Module *mod = 0;
> Triple TheTriple;
>
> @@ -281,7 +281,7 @@ static int compileModule(char **argv, LL
> Options.UseInitArray = UseInitArray;
> Options.SSPBufferSize = SSPBufferSize;
>
> - std::auto_ptr<TargetMachine>
> + OwningPtr<TargetMachine>
> target(TheTarget->createTargetMachine(TheTriple.getTriple(),
> MCPU, FeaturesStr, Options,
> RelocModel, CMModel, OLvl));
>
> Modified: llvm/trunk/tools/llvm-as/llvm-as.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-as/llvm-as.cpp?rev=179373&r1=179372&r2=179373&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llvm-as/llvm-as.cpp (original)
> +++ llvm/trunk/tools/llvm-as/llvm-as.cpp Fri Apr 12 05:56:28 2013
> @@ -94,7 +94,7 @@ int main(int argc, char **argv) {
>
> // Parse the file now...
> SMDiagnostic Err;
> - std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename, Err, Context));
> + OwningPtr<Module> M(ParseAssemblyFile(InputFilename, Err, Context));
> if (M.get() == 0) {
> Err.print(argv[0], errs());
> return 1;
>
> Modified: llvm/trunk/tools/llvm-dis/llvm-dis.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dis/llvm-dis.cpp?rev=179373&r1=179372&r2=179373&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llvm-dis/llvm-dis.cpp (original)
> +++ llvm/trunk/tools/llvm-dis/llvm-dis.cpp Fri Apr 12 05:56:28 2013
> @@ -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<Module> M;
> + OwningPtr<Module> M;
>
> // Use the bitcode streaming interface
> DataStreamer *streamer = getDataFileStreamer(InputFilename, &ErrorMessage);
>
> Modified: llvm/trunk/tools/llvm-extract/llvm-extract.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-extract/llvm-extract.cpp?rev=179373&r1=179372&r2=179373&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llvm-extract/llvm-extract.cpp (original)
> +++ llvm/trunk/tools/llvm-extract/llvm-extract.cpp Fri Apr 12 05:56:28 2013
> @@ -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<Module> M;
> + OwningPtr<Module> M;
> M.reset(getLazyIRFileModule(InputFilename, Err, Context));
>
> if (M.get() == 0) {
>
> Modified: llvm/trunk/tools/llvm-link/llvm-link.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-link/llvm-link.cpp?rev=179373&r1=179372&r2=179373&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llvm-link/llvm-link.cpp (original)
> +++ llvm/trunk/tools/llvm-link/llvm-link.cpp Fri Apr 12 05:56:28 2013
> @@ -53,13 +53,13 @@ DumpAsm("d", cl::desc("Print assembly as
> // 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<Module> LoadFile(const char *argv0,
> - const std::string &FN,
> - LLVMContext& Context) {
> +static inline OwningPtr<Module> 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<Module>();
> + return OwningPtr<Module>();
> }
>
> SMDiagnostic Err;
> @@ -68,10 +68,10 @@ static inline std::auto_ptr<Module> Load
>
> const std::string &FNStr = Filename.str();
> Result = ParseIRFile(FNStr, Err, Context);
> - if (Result) return std::auto_ptr<Module>(Result); // Load successful!
> + if (Result) return OwningPtr<Module>(Result); // Load successful!
>
> Err.print(argv0, errs());
> - return std::auto_ptr<Module>();
> + return OwningPtr<Module>();
> }
>
> 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<Module> Composite(LoadFile(argv[0],
> - InputFilenames[BaseArg], Context));
> + OwningPtr<Module> 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<Module> M(LoadFile(argv[0],
> - InputFilenames[i], Context));
> + OwningPtr<Module> M(LoadFile(argv[0], InputFilenames[i], Context));
> if (M.get() == 0) {
> errs() << argv[0] << ": error loading file '" <<InputFilenames[i]<< "'\n";
> return 1;
>
> Modified: llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp?rev=179373&r1=179372&r2=179373&view=diff
> ==============================================================================
> --- llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp (original)
> +++ llvm/trunk/tools/llvm-ranlib/llvm-ranlib.cpp Fri Apr 12 05:56:28 2013
> @@ -78,7 +78,7 @@ int main(int argc, char **argv) {
> }
>
> std::string err_msg;
> - std::auto_ptr<Archive>
> + OwningPtr<Archive>
> AutoArchive(Archive::OpenAndLoad(ArchivePath, Context, &err_msg));
> Archive* TheArchive = AutoArchive.get();
> if (!TheArchive) {
>
> Modified: llvm/trunk/tools/opt/opt.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=179373&r1=179372&r2=179373&view=diff
> ==============================================================================
> --- llvm/trunk/tools/opt/opt.cpp (original)
> +++ llvm/trunk/tools/opt/opt.cpp Fri Apr 12 05:56:28 2013
> @@ -589,7 +589,7 @@ int main(int argc, char **argv) {
> SMDiagnostic Err;
>
> // Load the input module...
> - std::auto_ptr<Module> M;
> + OwningPtr<Module> 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<TargetMachine> TM(Machine);
> + OwningPtr<TargetMachine> TM(Machine);
>
> // Add internal analysis passes from the target machine.
> if (TM.get())
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
--
Alexander Potapenko
Software Engineer
Google Moscow
More information about the llvm-commits
mailing list