[llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp

Nicholas Hildenbrandt hldnbrnd at cs.uiuc.edu
Mon Nov 18 16:23:01 PST 2002


Changes in directory llvm/lib/CWriter:

Writer.cpp updated: 1.74 -> 1.75

---
Log message:

(null)

---
Diffs of the changes:

Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.74 llvm/lib/CWriter/Writer.cpp:1.75
--- llvm/lib/CWriter/Writer.cpp:1.74	Mon Nov 18 14:55:50 2002
+++ llvm/lib/CWriter/Writer.cpp	Mon Nov 18 16:21:52 2002
@@ -156,8 +156,8 @@
 string CWriter::getValueName(const Value *V) {
   if (V->hasName()) {              // Print out the label if it exists...
     if (isa<GlobalValue>(V) &&     // Do not mangle globals...
-        cast<GlobalValue>(V)->hasExternalLinkage() && // Unless it's internal or
-        !MangledGlobals.count(V))  // Unless the name would collide if we don't
+        cast<GlobalValue>(V)->hasExternalLinkage())// && // Unless it's internal or
+        //!MangledGlobals.count(V))  // Unless the name would collide if we don't
       return makeNameProper(V->getName());
 
     return "l" + utostr(V->getType()->getUniqueID()) + "_" +
@@ -567,8 +567,12 @@
     Out << "\n/* Function Declarations */\n";
     needsMalloc = true;
     for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) {
-      printFunctionSignature(I, true);
-      Out << ";\n";
+      // If the function is external and the name collides don't print it.
+      // Sometimes the bytecode likes to have multiple "declerations" for external functions
+      if (I->hasInternalLinkage() || !MangledGlobals.count(I)){
+        printFunctionSignature(I, true);
+        Out << ";\n";
+      }
     }
   }
 





More information about the llvm-commits mailing list