reject forward references to functions whose type don't match

up with the definition (and fix a broken testcase).  PR6491.

llvm-svn: 101670
This commit is contained in:
Chris Lattner 2010-04-17 20:45:56 +00:00
parent aad5fa85d0
commit 5a44950aae
2 changed files with 5 additions and 1 deletions

View File

@ -2787,6 +2787,10 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
ForwardRefVals.find(FunctionName);
if (FRVI != ForwardRefVals.end()) {
Fn = M->getFunction(FunctionName);
if (Fn->getType() != PFT)
return Error(FRVI->second.second, "invalid forward reference to "
"function '" + FunctionName + "' with wrong type!");
ForwardRefVals.erase(FRVI);
} else if ((Fn = M->getFunction(FunctionName))) {
// If this function already exists in the symbol table, then it is

View File

@ -20,4 +20,4 @@ declare void @llvm.memset.i32(i8*, i8, i32, i32)
declare void @llvm.memmove.i32(i8*, i8*, i32, i32)
declare void @llvm.memmove.i64(i8*, i8*, i32, i32)
declare void @llvm.memmove.i64(i8*, i8*, i64, i32)