aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/CBackend/Writer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/CBackend/Writer.cpp')
-rw-r--r--lib/Target/CBackend/Writer.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp
index feaf135..b7207d5 100644
--- a/lib/Target/CBackend/Writer.cpp
+++ b/lib/Target/CBackend/Writer.cpp
@@ -572,17 +572,16 @@ void CWriter::printModule(Module *M) {
// 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...