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

Chris Lattner lattner at cs.uiuc.edu
Wed Oct 16 15:09:07 PDT 2002


Changes in directory llvm/lib/CWriter:

Writer.cpp updated: 1.64 -> 1.65

---
Log message:

Fix bug: CBackend/2002-10-16-External.ll


---
Diffs of the changes:

Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.64 llvm/lib/CWriter/Writer.cpp:1.65
--- llvm/lib/CWriter/Writer.cpp:1.64	Tue Oct 15 19:08:22 2002
+++ llvm/lib/CWriter/Writer.cpp	Wed Oct 16 15:08:47 2002
@@ -572,17 +572,16 @@
   // Output the global variable definitions and contents...
   if (!M->gempty()) {
     Out << "\n\n/* Global Variable Definitions and Initialization */\n";
-    for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) {
-      if (I->hasInternalLinkage())
-        Out << "static ";
-      printType(I->getType()->getElementType(), getValueName(I));
+    for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
+      if (!I->isExternal()) {
+        if (I->hasInternalLinkage())
+          Out << "static ";
+        printType(I->getType()->getElementType(), getValueName(I));
       
-      if (I->hasInitializer()) {
         Out << " = " ;
         writeOperand(I->getInitializer());
+        Out << ";\n";
       }
-      Out << ";\n";
-    }
   }
 
   // Output all of the functions...





More information about the llvm-commits mailing list