[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y
Chris Lattner
lattner at cs.uiuc.edu
Mon Mar 8 10:15:01 PST 2004
Changes in directory llvm/lib/AsmParser:
llvmAsmParser.y updated: 1.157 -> 1.158
---
Log message:
Insert functions into the module promptly, not lazily. This fixes a bug
I introduced last night. Note to self: test the *correct* tree...
---
Diffs of the changes: (+2 -11)
Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.157 llvm/lib/AsmParser/llvmAsmParser.y:1.158
--- llvm/lib/AsmParser/llvmAsmParser.y:1.157 Mon Mar 8 00:09:57 2004
+++ llvm/lib/AsmParser/llvmAsmParser.y Mon Mar 8 10:14:19 2004
@@ -1295,8 +1295,6 @@
//
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 @@
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 @@
FunctionProto : DECLARE { CurFun.isDeclare = true; } FunctionHeaderH {
$$ = CurFun.CurrentFunction;
- assert($$->getParent() == 0 && "Function already in module!");
- CurModule.CurrentModule->getFunctionList().push_back($$);
CurFun.FunctionDone();
};
More information about the llvm-commits
mailing list