aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-20 04:49:11 +0000
committerChris Lattner <sabre@nondot.org>2010-04-20 04:49:11 +0000
commitdc04d854cb4febe2106aed4758b8161085a26a22 (patch)
tree0ed69bfa2f1e1ef3e5f5c92b1322b9372b8ecab0
parent3799fdc10724d4bcbd88b186e49dcb695ace4adf (diff)
downloadexternal_llvm-dc04d854cb4febe2106aed4758b8161085a26a22.zip
external_llvm-dc04d854cb4febe2106aed4758b8161085a26a22.tar.gz
external_llvm-dc04d854cb4febe2106aed4758b8161085a26a22.tar.bz2
reapply 'reject forward references to functions whose type don't match'
now that the testsuite has been updated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101866 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AsmParser/LLParser.cpp4
-rw-r--r--test/Bitcode/memcpy.ll2
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index fe8e9c7..aa887d2 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -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
diff --git a/test/Bitcode/memcpy.ll b/test/Bitcode/memcpy.ll
index b6573b5..299eb1e 100644
--- a/test/Bitcode/memcpy.ll
+++ b/test/Bitcode/memcpy.ll
@@ -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)