[llvm-commits] [llvm] r93067 - /llvm/trunk/lib/AsmParser/LLParser.cpp

Chris Lattner sabre at nondot.org
Sat Jan 9 11:20:07 PST 2010


Author: lattner
Date: Sat Jan  9 13:20:07 2010
New Revision: 93067

URL: http://llvm.org/viewvc/llvm-project?rev=93067&view=rev
Log:
fix PR5983, reject function bodies with no blocks per the grammar.

Modified:
    llvm/trunk/lib/AsmParser/LLParser.cpp

Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=93067&r1=93066&r2=93067&view=diff

==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Sat Jan  9 13:20:07 2010
@@ -2779,6 +2779,10 @@
   
   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;
 





More information about the llvm-commits mailing list