Changes in directory llvm/lib/Linker:

LinkModules.cpp updated: 1.136 -> 1.137
---
Log message:

simplify this code by using value::takename


---
Diffs of the changes:  (+5 -8)

 LinkModules.cpp |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)


Index: llvm/lib/Linker/LinkModules.cpp
diff -u llvm/lib/Linker/LinkModules.cpp:1.136 
llvm/lib/Linker/LinkModules.cpp:1.137
--- llvm/lib/Linker/LinkModules.cpp:1.136       Mon Feb  5 14:47:20 2007
+++ llvm/lib/Linker/LinkModules.cpp     Sat Feb 10 18:39:38 2007
@@ -337,18 +337,15 @@
   ValueSymbolTable &ST = GV->getParent()->getValueSymbolTable();
 
   // If there is a conflict, rename the conflict.
-  GlobalValue *ConflictGV = cast_or_null<GlobalValue>(ST.lookup(Name));
-  if (ConflictGV) {
+  if (GlobalValue *ConflictGV = cast_or_null<GlobalValue>(ST.lookup(Name))) {
     assert(ConflictGV->hasInternalLinkage() &&
            "Not conflicting with a static global, should link instead!");
-    ConflictGV->setName("");        // Eliminate the conflict
-  }
-  GV->setName(Name);              // Force the name back
-  if (ConflictGV) {
-    ConflictGV->setName(Name);      // This will cause ConflictGV to get 
renamed
+    GV->takeName(ConflictGV);
+    ConflictGV->setName(Name);    // This will cause ConflictGV to get renamed
     assert(ConflictGV->getName() != Name && "ForceRenaming didn't work");
+  } else {
+    GV->setName(Name);              // Force the name back
   }
-  assert(GV->getName() == Name && "ForceRenaming didn't work");
 }
 
 /// CopyGVAttributes - copy additional attributes (those not needed to 
construct



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to