[llvm] r224104 - Remove an unnecessary reference variable that pointed to a unique_ptr variable. Just use the unique_ptr variable directly.

Craig Topper craig.topper at gmail.com
Thu Dec 11 23:52:07 PST 2014


Author: ctopper
Date: Fri Dec 12 01:52:06 2014
New Revision: 224104

URL: http://llvm.org/viewvc/llvm-project?rev=224104&view=rev
Log:
Remove an unnecessary reference variable that pointed to a unique_ptr variable. Just use the unique_ptr variable directly.

Modified:
    llvm/trunk/tools/llc/llc.cpp

Modified: llvm/trunk/tools/llc/llc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=224104&r1=224103&r2=224104&view=diff
==============================================================================
--- llvm/trunk/tools/llc/llc.cpp (original)
+++ llvm/trunk/tools/llc/llc.cpp Fri Dec 12 01:52:06 2014
@@ -271,10 +271,10 @@ static int compileModule(char **argv, LL
   Options.MCOptions.MCUseDwarfDirectory = EnableDwarfDirectory;
   Options.MCOptions.AsmVerbose = AsmVerbose;
 
-  std::unique_ptr<TargetMachine> target(
+  std::unique_ptr<TargetMachine> Target(
       TheTarget->createTargetMachine(TheTriple.getTriple(), MCPU, FeaturesStr,
                                      Options, RelocModel, CMModel, OLvl));
-  assert(target.get() && "Could not allocate target machine!");
+  assert(Target && "Could not allocate target machine!");
 
   // If we don't have a module then just exit now. We do this down
   // here since the CPU/Feature help is underneath the target machine
@@ -283,7 +283,6 @@ static int compileModule(char **argv, LL
     return 0;
 
   assert(M && "Should have exited if we didn't have a module!");
-  TargetMachine &Target = *target.get();
 
   if (GenerateSoftFloatCalls)
     FloatABIForCalls = FloatABI::Soft;
@@ -303,7 +302,7 @@ static int compileModule(char **argv, LL
   PM.add(TLI);
 
   // Add the target data from the target machine, if it exists, or the module.
-  if (const DataLayout *DL = Target.getSubtargetImpl()->getDataLayout())
+  if (const DataLayout *DL = Target->getSubtargetImpl()->getDataLayout())
     M->setDataLayout(DL);
   PM.add(new DataLayoutPass());
 
@@ -336,8 +335,8 @@ static int compileModule(char **argv, LL
     }
 
     // Ask the target to add backend passes as necessary.
-    if (Target.addPassesToEmitFile(PM, FOS, FileType, NoVerify,
-                                   StartAfterID, StopAfterID)) {
+    if (Target->addPassesToEmitFile(PM, FOS, FileType, NoVerify,
+                                    StartAfterID, StopAfterID)) {
       errs() << argv[0] << ": target does not support generation of this"
              << " file type!\n";
       return 1;





More information about the llvm-commits mailing list