summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser
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
commit5a44950aae2d6a27df8498bd69050a2c397d4f68 (patch)
tree5d93823936f9e496eca05d083b6cb27944f0edcb /llvm/lib/AsmParser
parentaad5fa85d06989ee3270e2012245f481b5de19e3 (diff)
downloadbcm5719-llvm-5a44950aae2d6a27df8498bd69050a2c397d4f68.tar.gz
bcm5719-llvm-5a44950aae2d6a27df8498bd69050a2c397d4f68.zip
reject forward references to functions whose type don't match
up with the definition (and fix a broken testcase). PR6491. llvm-svn: 101670
Diffstat (limited to 'llvm/lib/AsmParser')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index fe8e9c7f07d..aa887d21777 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud