aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-upgrade
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-04-16 02:56:33 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-04-16 02:56:33 +0000
commit53bd704b999255649c6c3cb4f08e8a57ac2b309a (patch)
tree1abf7d3de6e2042ef2598cb9a93772806c1b9ca5 /tools/llvm-upgrade
parent3e35c8d15e6981ab759820e84ffcb945bfcef71b (diff)
For PR1336:
When upgrading global vars, look for conflicts with functions as well. This fixes test/Transforms/GlobalDCE/2002-08-17-FunctionDGE.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36103 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-upgrade')
-rw-r--r--tools/llvm-upgrade/UpgradeParser.y7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/llvm-upgrade/UpgradeParser.y b/tools/llvm-upgrade/UpgradeParser.y
index 697c7af2f8..84f4eb547f 100644
--- a/tools/llvm-upgrade/UpgradeParser.y
+++ b/tools/llvm-upgrade/UpgradeParser.y
@@ -934,8 +934,9 @@ ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
// of this global in the module and emit warnings if there are conflicts.
if (!Name.empty()) {
// The global has a name. See if there's an existing one of the same name.
- if (CurModule.CurrentModule->getNamedGlobal(Name)) {
- // We found an existing global ov the same name. This isn't allowed
+ if (CurModule.CurrentModule->getNamedGlobal(Name) ||
+ CurModule.CurrentModule->getFunction(Name)) {
+ // We found an existing global of the same name. This isn't allowed
// in LLVM 2.0. Consequently, we must alter the name of the global so it
// can at least compile. This can happen because of type planes
// There is alread a global of the same name which means there is a
@@ -2999,7 +3000,7 @@ FunctionHeaderH
AI->setName("");
}
} else if (Conflict) {
- // We have two globals with the same name and different types.
+ // We have two globals with the same name and different types.
// Previously, this was permitted because the symbol table had
// "type planes" and names only needed to be distinct within a
// type plane. After PR411 was fixed, this is no loner the case.