summaryrefslogtreecommitdiff
path: root/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-09 19:20:07 +0000
committerChris Lattner <sabre@nondot.org>2010-01-09 19:20:07 +0000
commit2fdf8dbed5661336059f647700e66bca1f4cd51a (patch)
treeaad3afb2e9d412b95c2f1b2b0809e512074e8b96 /lib/AsmParser/LLParser.cpp
parent873187c0426e069e92da3b644133059a8ee3948e (diff)
downloadllvm-2fdf8dbed5661336059f647700e66bca1f4cd51a.tar.gz
llvm-2fdf8dbed5661336059f647700e66bca1f4cd51a.tar.bz2
llvm-2fdf8dbed5661336059f647700e66bca1f4cd51a.tar.xz
fix PR5983, reject function bodies with no blocks per the grammar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93067 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 3ee683f7f6..9de1ff940e 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -2779,6 +2779,10 @@ bool LLParser::ParseFunctionBody(Function &Fn) {
PerFunctionState PFS(*this, Fn, FunctionNumber);
+ // We need at least one basic block.
+ if (Lex.getKind() == lltok::rbrace || Lex.getKind() == lltok::kw_end)
+ return TokError("function body requires at least one basic block");
+
while (Lex.getKind() != lltok::rbrace && Lex.getKind() != lltok::kw_end)
if (ParseBasicBlock(PFS)) return true;