summaryrefslogtreecommitdiff
path: root/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-17 20:45:56 +0000
committerChris Lattner <sabre@nondot.org>2010-04-17 20:45:56 +0000
commit77e80deabcdbb84b9dbc76152ecc4d606aec0bfd (patch)
tree466052e1cff8893272af8c2f589374498ffee38d /lib/AsmParser/LLParser.cpp
parentb5f6af644ebe504479a74341ae8b0c706e7a5fcc (diff)
downloadllvm-77e80deabcdbb84b9dbc76152ecc4d606aec0bfd.tar.gz
llvm-77e80deabcdbb84b9dbc76152ecc4d606aec0bfd.tar.bz2
llvm-77e80deabcdbb84b9dbc76152ecc4d606aec0bfd.tar.xz
reject forward references to functions whose type don't match
up with the definition (and fix a broken testcase). PR6491. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101670 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/LLParser.cpp')
-rw-r--r--lib/AsmParser/LLParser.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index fe8e9c7f07..aa887d2177 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