From 2a408f06b545a4815666f22a72f62dd38e7ebd10 Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Sat, 5 Oct 2002 23:43:10 +0000 Subject: [PATCH] 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). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4043 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/CBackend/CBackend.cpp | 5 ++--- lib/Target/CBackend/Writer.cpp | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index bc2106d78fe..51a3d168c17 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -563,9 +563,8 @@ void CWriter::printModule(Module *M) { 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->hasExternalLinkage()) - continue; // printed above! - Out << "static "; + if (I->hasInternalLinkage()) + Out << "static "; printType(I->getType()->getElementType(), getValueName(I)); if (I->hasInitializer()) { diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index bc2106d78fe..51a3d168c17 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -563,9 +563,8 @@ void CWriter::printModule(Module *M) { 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->hasExternalLinkage()) - continue; // printed above! - Out << "static "; + if (I->hasInternalLinkage()) + Out << "static "; printType(I->getType()->getElementType(), getValueName(I)); if (I->hasInitializer()) {