Fix to get correct variable names for extern globals that are later defined.

This commit is contained in:
Matt Pharr
2012-03-29 11:50:15 -07:00
parent d5e3416e8e
commit 255791f18e

View File

@@ -366,8 +366,11 @@ Module::AddGlobalVariable(Symbol *sym, Expr *initExpr, bool isConst) {
// Patch up any references to the previous GlobalVariable (e.g. from a // Patch up any references to the previous GlobalVariable (e.g. from a
// declaration of a global that was later defined.) // declaration of a global that was later defined.)
if (oldGV != NULL) if (oldGV != NULL) {
oldGV->replaceAllUsesWith(sym->storagePtr); oldGV->replaceAllUsesWith(sym->storagePtr);
oldGV->removeFromParent();
sym->storagePtr->setName(sym->name.c_str());
}
if (diBuilder) { if (diBuilder) {
llvm::DIFile file = sym->pos.GetDIFile(); llvm::DIFile file = sym->pos.GetDIFile();