diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-03-08 19:11:42 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-03-08 19:11:42 +0000 |
| commit | 108308aa91408010ca969a7b11227c9264b787f1 (patch) | |
| tree | 4c4c4a1299860cc3cb4700768269fd89defc721b /llvm/lib | |
| parent | ff74b62f66926d8d14e8476202929b9fbe9068f4 (diff) | |
| download | bcm5719-llvm-108308aa91408010ca969a7b11227c9264b787f1.tar.gz bcm5719-llvm-108308aa91408010ca969a7b11227c9264b787f1.zip | |
Fix bug: test/Regression/2002-03-08-NameCollision2.ll
llvm-svn: 1839
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/AsmParser/llvmAsmParser.y | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y index 9d6c99d41ee..8a1cf0ab32b 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y +++ b/llvm/lib/AsmParser/llvmAsmParser.y @@ -1110,8 +1110,8 @@ Module : MethodList { // MethodList : MethodList Method { $$ = $1; - if (!$2->getParent()) - $1->getMethodList().push_back($2); + assert($2->getParent() == 0 && "Method already in module!"); + $1->getMethodList().push_back($2); CurMeth.MethodDone(); } | MethodList MethodProto { @@ -1184,6 +1184,11 @@ MethodHeaderH : OptInternal TypesV STRINGCONSTANT '(' ArgList ')' { // or it needs to be. if (!CurMeth.isDeclare && !M->isExternal()) ThrowException("Redefinition of method '" + MethodName + "'!"); + + // If we found a preexisting method prototype, remove it from the module, + // so that we don't get spurious conflicts with global & local variables. + // + CurModule.CurrentModule->getMethodList().remove(M); } } @@ -1232,8 +1237,8 @@ Method : BasicBlockList END { MethodProto : DECLARE { CurMeth.isDeclare = true; } MethodHeaderH { $$ = CurMeth.CurrentMethod; - if (!$$->getParent()) - CurModule.CurrentModule->getMethodList().push_back($$); + assert($$->getParent() == 0 && "Method already in module!"); + CurModule.CurrentModule->getMethodList().push_back($$); CurMeth.MethodDone(); } |

