From 1391a42343d7a597b9ee413551ba013218d21b8c Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sun, 7 Jun 2009 17:23:52 +0000 Subject: Diagnose some more syntax errors instead of crashing. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@73032 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Expr/Parser.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Expr/Parser.cpp b/lib/Expr/Parser.cpp index f6487674..a5c6123f 100644 --- a/lib/Expr/Parser.cpp +++ b/lib/Expr/Parser.cpp @@ -589,6 +589,12 @@ DeclResult ParserImpl::ParseQueryCommand() { return DeclResult(); } + if (Tok.kind != Token::LSquare) { + Error("malformed query, expected expression list."); + SkipUntilRParen(); + return DeclResult(); + } + ConsumeLSquare(); // FIXME: Should avoid reading past unbalanced parens here. while (Tok.kind != Token::RSquare) { @@ -611,6 +617,12 @@ DeclResult ParserImpl::ParseQueryCommand() { // Return if there are no optional lists of things to evaluate. if (Tok.kind == Token::RParen) goto exit; + + if (Tok.kind != Token::LSquare) { + Error("malformed query, expected expression list."); + SkipUntilRParen(); + return DeclResult(); + } ConsumeLSquare(); // FIXME: Should avoid reading past unbalanced parens here. -- cgit 1.4.1