[llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp
Nicholas Hildenbrandt
hldnbrnd at cs.uiuc.edu
Mon Oct 28 13:06:01 PST 2002
Changes in directory llvm/lib/CWriter:
Writer.cpp updated: 1.66 -> 1.67
---
Log message:
(null)
---
Diffs of the changes:
Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.66 llvm/lib/CWriter/Writer.cpp:1.67
--- llvm/lib/CWriter/Writer.cpp:1.66 Wed Oct 23 13:59:40 2002
+++ llvm/lib/CWriter/Writer.cpp Mon Oct 28 13:05:12 2002
@@ -451,7 +451,7 @@
return;
}
- if (Operand->hasName()) {
+ if (Operand->hasName()) {
Out << getValueName(Operand);
} else if (Constant *CPV = dyn_cast<Constant>(Operand)) {
printConstant(CPV);
@@ -575,6 +575,19 @@
Out << "extern void * malloc(size_t);\n\n";
}
+ // Output the global variable declerations
+ if (!M->gempty()) {
+ Out << "\n\n/* Global Variable Declerations */\n";
+ for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
+ if (!I->isExternal()) {
+ Out << "extern ";
+ printType(I->getType()->getElementType(), getValueName(I));
+
+ Out << ";\n";
+ }
+ }
+
+
// Output the global variable definitions and contents...
if (!M->gempty()) {
Out << "\n\n/* Global Variable Definitions and Initialization */\n";
More information about the llvm-commits
mailing list