aboutsummaryrefslogtreecommitdiffstats
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
commit02af784535ff1c245b49d4def34c88d563df1c90 (patch)
treeaad3afb2e9d412b95c2f1b2b0809e512074e8b96
parentd16c55174a330da7d44ee33a1fe2053ffa57144d (diff)
downloadexternal_llvm-02af784535ff1c245b49d4def34c88d563df1c90.zip
external_llvm-02af784535ff1c245b49d4def34c88d563df1c90.tar.gz
external_llvm-02af784535ff1c245b49d4def34c88d563df1c90.tar.bz2
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
-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 3ee683f..9de1ff9 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;