[llvm-commits] [llvm] r48182 - /llvm/trunk/lib/Linker/LinkModules.cpp

Anton Korobeynikov asl at math.spbu.ru
Mon Mar 10 15:36:08 PDT 2008


Author: asl
Date: Mon Mar 10 17:36:08 2008
New Revision: 48182

URL: http://llvm.org/viewvc/llvm-project?rev=48182&view=rev
Log:
Syntactic sugar'ify stuff :)

Modified:
    llvm/trunk/lib/Linker/LinkModules.cpp

Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=48182&r1=48181&r2=48182&view=diff

==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Mon Mar 10 17:36:08 2008
@@ -316,7 +316,7 @@
   
   // Cache the mapping in our local map structure
   if (Result) {
-    ValueMap.insert(std::make_pair(In, Result));
+    ValueMap[In] = Result;
     return Result;
   }
   
@@ -512,7 +512,8 @@
         ForceRenaming(NewDGV, SGV->getName());
 
       // Make sure to remember this mapping...
-      ValueMap.insert(std::make_pair(SGV, NewDGV));
+      ValueMap[SGV] = NewDGV;
+
       if (SGV->hasAppendingLinkage())
         // Keep track that this is an appending variable...
         AppendingVars.insert(std::make_pair(SGV->getName(), NewDGV));
@@ -532,22 +533,23 @@
       CopyGVAttributes(NewDGV, SGV);
 
       // Make sure to remember this mapping...
-      ValueMap.insert(std::make_pair(SGV, NewDGV));
+      ValueMap[SGV] = NewDGV;
 
       // Keep track that this is an appending variable...
       AppendingVars.insert(std::make_pair(SGV->getName(), NewDGV));
     } else if (GlobalAlias *DGA = dyn_cast<GlobalAlias>(DGV)) {
       // SGV is global, but DGV is alias. The only valid mapping is when SGV is
       // external declaration, which is effectively a no-op. Also make sure
-      // linkage is correct.
+      // linkage calculation was correct.
       if (SGV->isDeclaration() && !LinkFromSrc) {
         // Make sure to remember this mapping...
-        ValueMap.insert(std::make_pair(SGV, DGA));
+        ValueMap[SGV] = DGA;
       } else
         return Error(Err, "Global-Alias Collision on '" + SGV->getName() +
                      "': symbol multiple defined");
     } else if (GlobalVariable *DGVar = dyn_cast<GlobalVariable>(DGV)) {
-      // Otherwise, perform the mapping as instructed by GetLinkageResult.
+      // Otherwise, perform the global-global mapping as instructed by
+      // GetLinkageResult.
       if (LinkFromSrc) {
         // Propagate alignment, section, and visibility info.
         CopyGVAttributes(DGVar, SGV);
@@ -592,9 +594,7 @@
       DGVar->setLinkage(NewLinkage);
 
       // Make sure to remember this mapping...
-      ValueMap.insert(std::make_pair(SGV,
-                                     ConstantExpr::getBitCast(DGVar,
-                                                              SGV->getType())));
+      ValueMap[SGV] = ConstantExpr::getBitCast(DGVar, SGV->getType());
     }
   }
   return false;
@@ -726,7 +726,7 @@
 
     // Remember this mapping so uses in the source module get remapped
     // later by RemapOperand.
-    ValueMap.insert(std::make_pair(SGA, NewGA));
+    ValueMap[SGA] = NewGA;
   }
 
   return false;
@@ -860,7 +860,7 @@
         ForceRenaming(NewDF, SF->getName());
 
       // ... and remember this mapping...
-      ValueMap.insert(std::make_pair(SF, NewDF));
+      ValueMap[SF] = NewDF;
     } else if (SF->isDeclaration()) {
       // If SF is a declaration or if both SF & DF are declarations, just link 
       // the declarations, we aren't adding anything.
@@ -870,7 +870,7 @@
           DF->setLinkage(SF->getLinkage());          
         }        
       } else {
-        ValueMap.insert(std::make_pair(SF, DF));
+        ValueMap[SF] = DF;
       }      
     } else if (DF->isDeclaration() && !DF->hasDLLImportLinkage()) {
       // If DF is external but SF is not...
@@ -881,7 +881,7 @@
       DF->setVisibility(SF->getVisibility());
     } else if (SF->hasWeakLinkage() || SF->hasLinkOnceLinkage()) {
       // At this point we know that DF has LinkOnce, Weak, or External* linkage.
-      ValueMap.insert(std::make_pair(SF, DF));
+      ValueMap[SF] = DF;
 
       // Linkonce+Weak = Weak
       // *+External Weak = *
@@ -890,7 +890,7 @@
         DF->setLinkage(SF->getLinkage());
     } else if (DF->hasWeakLinkage() || DF->hasLinkOnceLinkage()) {
       // At this point we know that SF has LinkOnce or External* linkage.
-      ValueMap.insert(std::make_pair(SF, DF));
+      ValueMap[SF] = DF;
       if (!SF->hasLinkOnceLinkage() && !SF->hasExternalWeakLinkage())
         // Don't inherit linkonce & external weak linkage
         DF->setLinkage(SF->getLinkage());
@@ -924,7 +924,7 @@
     DI->setName(I->getName());  // Copy the name information over...
 
     // Add a mapping to our local map
-    ValueMap.insert(std::make_pair(I, DI));
+    ValueMap[I] = DI;
   }
 
   // Splice the body of the source function into the dest function.





More information about the llvm-commits mailing list