From 255791f18eed6477e66fcdc3de5be631e41c8b88 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Thu, 29 Mar 2012 11:50:15 -0700 Subject: [PATCH] Fix to get correct variable names for extern globals that are later defined. --- module.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module.cpp b/module.cpp index 87cb1a88..f9e38d87 100644 --- a/module.cpp +++ b/module.cpp @@ -366,8 +366,11 @@ Module::AddGlobalVariable(Symbol *sym, Expr *initExpr, bool isConst) { // Patch up any references to the previous GlobalVariable (e.g. from a // declaration of a global that was later defined.) - if (oldGV != NULL) + if (oldGV != NULL) { oldGV->replaceAllUsesWith(sym->storagePtr); + oldGV->removeFromParent(); + sym->storagePtr->setName(sym->name.c_str()); + } if (diBuilder) { llvm::DIFile file = sym->pos.GetDIFile();