diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-09 19:20:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-09 19:20:07 +0000 |
commit | 2fdf8dbed5661336059f647700e66bca1f4cd51a (patch) | |
tree | aad3afb2e9d412b95c2f1b2b0809e512074e8b96 /lib/AsmParser | |
parent | 873187c0426e069e92da3b644133059a8ee3948e (diff) | |
download | external_llvm-2fdf8dbed5661336059f647700e66bca1f4cd51a.zip external_llvm-2fdf8dbed5661336059f647700e66bca1f4cd51a.tar.gz external_llvm-2fdf8dbed5661336059f647700e66bca1f4cd51a.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
Diffstat (limited to 'lib/AsmParser')
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 4 |
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; |