mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-22 03:39:03 +00:00
Fix a regression from last night. Apparently the CFE is broken and outputs
functions multiple times, expecting them to be merged. This should be fixed in the CFE, then here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14823 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5f8cce1348
commit
d9ce6adfcc
@ -1551,14 +1551,24 @@ FunctionHeaderH : TypesV Name '(' ArgList ')' {
|
|||||||
const PointerType *PFT = PointerType::get(FT);
|
const PointerType *PFT = PointerType::get(FT);
|
||||||
delete $1;
|
delete $1;
|
||||||
|
|
||||||
|
Function *Fn = 0;
|
||||||
// Is the function already in symtab?
|
// Is the function already in symtab?
|
||||||
if (CurModule.CurrentModule->getFunction(FunctionName, FT))
|
if ((Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
|
||||||
|
// Yes it is. If this is the case, either we need to be a forward decl,
|
||||||
|
// or it needs to be.
|
||||||
|
if (!CurFun.isDeclare && !Fn->isExternal())
|
||||||
ThrowException("Redefinition of function '" + FunctionName + "'!");
|
ThrowException("Redefinition of function '" + FunctionName + "'!");
|
||||||
|
|
||||||
Function *Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
|
// 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,
|
||||||
CurModule.CurrentModule);
|
CurModule.CurrentModule);
|
||||||
InsertValue(Fn, CurModule.Values);
|
InsertValue(Fn, CurModule.Values);
|
||||||
CurModule.DeclareNewGlobalValue(Fn, ValID::create($2));
|
CurModule.DeclareNewGlobalValue(Fn, ValID::create($2));
|
||||||
|
}
|
||||||
free($2); // Free strdup'd memory!
|
free($2); // Free strdup'd memory!
|
||||||
|
|
||||||
CurFun.FunctionStart(Fn);
|
CurFun.FunctionStart(Fn);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user