Bug fix: In preventing static global variables from being printed twice,

I also prevented external globals from being printed twice, but they
should (extern declaration and definition).

llvm-svn: 4043
This commit is contained in:
Vikram S. Adve 2002-10-05 23:43:10 +00:00
parent b8aef8eff8
commit 2cc6609e25
1 changed files with 2 additions and 3 deletions

View File

@ -563,9 +563,8 @@ void CWriter::printModule(Module *M) {
if (!M->gempty()) { if (!M->gempty()) {
Out << "\n\n/* Global Variable Definitions and Initialization */\n"; Out << "\n\n/* Global Variable Definitions and Initialization */\n";
for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) { for (Module::giterator I = M->gbegin(), E = M->gend(); I != E; ++I) {
if (I->hasExternalLinkage()) if (I->hasInternalLinkage())
continue; // printed above! Out << "static ";
Out << "static ";
printType(I->getType()->getElementType(), getValueName(I)); printType(I->getType()->getElementType(), getValueName(I));
if (I->hasInitializer()) { if (I->hasInitializer()) {