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

Chris Lattner sabre at nondot.org
Sun Jul 13 22:52:33 PDT 2008


Author: lattner
Date: Mon Jul 14 00:52:33 2008
New Revision: 53545

URL: http://llvm.org/viewvc/llvm-project?rev=53545&view=rev
Log:
wrap long lines, remove some code from a non-assert build.

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=53545&r1=53544&r2=53545&view=diff

==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Mon Jul 14 00:52:33 2008
@@ -340,6 +340,7 @@
   return false;
 }
 
+#ifndef NDEBUG
 static void PrintMap(const std::map<const Value*, Value*> &M) {
   for (std::map<const Value*, Value*>::const_iterator I = M.begin(), E =M.end();
        I != E; ++I) {
@@ -350,6 +351,7 @@
     cerr << "\n";
   }
 }
+#endif
 
 
 // RemapOperand - Use ValueMap to convert constants from one module to another.
@@ -388,9 +390,8 @@
       for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i)
         Ops.push_back(cast<Constant>(RemapOperand(CE->getOperand(i),ValueMap)));
       Result = CE->getWithOperands(Ops);
-    } else if (isa<GlobalValue>(CPV)) {
-      assert(0 && "Unmapped global?");
     } else {
+      assert(!isa<GlobalValue>(CPV) && "Unmapped global?");
       assert(0 && "Unknown type of derived type constant value!");
     }
   } else if (isa<InlineAsm>(In)) {
@@ -403,12 +404,13 @@
     return Result;
   }
   
-
+#ifndef NDEBUG
   cerr << "LinkModules ValueMap: \n";
   PrintMap(ValueMap);
 
   cerr << "Couldn't remap value: " << (void*)In << " " << *In << "\n";
   assert(0 && "Couldn't remap value!");
+#endif
   return 0;
 }
 
@@ -533,8 +535,8 @@
                     std::multimap<std::string, GlobalVariable *> &AppendingVars,
                         std::string *Err) {
   // Loop over all of the globals in the src module, mapping them over as we go
-  for (Module::const_global_iterator I = Src->global_begin(), E = Src->global_end();
-       I != E; ++I) {
+  for (Module::const_global_iterator I = Src->global_begin(),
+       E = Src->global_end(); I != E; ++I) {
     const GlobalVariable *SGV = I;
     GlobalValue *DGV = 0;
 





More information about the llvm-commits mailing list