diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-03-08 16:14:19 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-03-08 16:14:19 +0000 |
| commit | e2b27080e7a5a3e7163a31770a333ab08fc518da (patch) | |
| tree | 2dde551bcf738888e17d09dd13c315f95b3e9340 /llvm/lib/AsmParser | |
| parent | ea0789ca7b8b25f650b926c58eb2db905a46a08b (diff) | |
| download | bcm5719-llvm-e2b27080e7a5a3e7163a31770a333ab08fc518da.tar.gz bcm5719-llvm-e2b27080e7a5a3e7163a31770a333ab08fc518da.zip | |
Insert functions into the module promptly, not lazily. This fixes a bug
I introduced last night. Note to self: test the *correct* tree...
llvm-svn: 12220
Diffstat (limited to 'llvm/lib/AsmParser')
| -rw-r--r-- | llvm/lib/AsmParser/llvmAsmParser.y | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y index 5e2b9f71279..9c68cfca5d2 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y +++ b/llvm/lib/AsmParser/llvmAsmParser.y @@ -1295,8 +1295,6 @@ Module : FunctionList { // FunctionList : FunctionList Function { $$ = $1; - assert($2->getParent() == 0 && "Function already in module!"); - $1->getFunctionList().push_back($2); CurFun.FunctionDone(); } | FunctionList FunctionProto { @@ -1471,18 +1469,13 @@ FunctionHeaderH : TypesV Name '(' ArgList ')' { if (!CurFun.isDeclare && !Fn->isExternal()) ThrowException("Redefinition of function '" + FunctionName + "'!"); - // If we found a preexisting function prototype, remove it from the - // module, so that we don't get spurious conflicts with global & local - // variables. - // - CurModule.CurrentModule->getFunctionList().remove(Fn); - // Make sure to strip off any argument names so we can't get conflicts... for (Function::aiterator AI = Fn->abegin(), AE = Fn->aend(); AI != AE; ++AI) AI->setName(""); } else { // Not already defined? - Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName); + Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, + CurModule.CurrentModule); InsertValue(Fn, CurModule.Values); CurModule.DeclareNewGlobalValue(Fn, ValID::create($2)); } @@ -1534,8 +1527,6 @@ Function : BasicBlockList END { FunctionProto : DECLARE { CurFun.isDeclare = true; } FunctionHeaderH { $$ = CurFun.CurrentFunction; - assert($$->getParent() == 0 && "Function already in module!"); - CurModule.CurrentModule->getFunctionList().push_back($$); CurFun.FunctionDone(); }; |

