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 | 63a225050fe1c9350004f2422ef956ff0e594208 (patch) | |
tree | c7b25e24d9400ffb88e9c8764a8678e5df1b5afb /lib/AsmParser/llvmAsmParser.y | |
parent | 802b5ab844070daf5a3e8947124c476b88a5d22c (diff) | |
download | external_llvm-63a225050fe1c9350004f2422ef956ff0e594208.zip external_llvm-63a225050fe1c9350004f2422ef956ff0e594208.tar.gz external_llvm-63a225050fe1c9350004f2422ef956ff0e594208.tar.bz2 |
Insert functions into the module promptly, not lazily. This fixes a bug
I introduced last night. Note to self: test the *correct* tree...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12220 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/llvmAsmParser.y')
-rw-r--r-- | lib/AsmParser/llvmAsmParser.y | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 5e2b9f7..9c68cfc 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/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(); }; |