From 8d6fd4769b60950decda14cfda4f585502ed2c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 14 Jul 2020 11:22:42 +0200 Subject: [PATCH] Bug hunting; Terminating analysis --- lib/exprengine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/exprengine.cpp b/lib/exprengine.cpp index 4a2d66808..388f4149c 100644 --- a/lib/exprengine.cpp +++ b/lib/exprengine.cpp @@ -154,6 +154,7 @@ namespace { const Token *tok; const std::string what; }; + struct TerminateExpression {}; } static std::string str(ExprEngine::ValuePtr val) @@ -2153,6 +2154,9 @@ static ExprEngine::ValuePtr executeStringLiteral(const Token *tok, Data &data) static ExprEngine::ValuePtr executeExpression1(const Token *tok, Data &data) { + if (data.settings->terminated()) + throw TerminateExpression(); + if (tok->str() == "return") return executeReturn(tok, data); @@ -2489,6 +2493,8 @@ void ExprEngine::executeAllFunctions(ErrorLogger *errorLogger, const Tokenizer * // FIXME.. there should not be exceptions std::string functionName = functionScope->function->name(); std::cout << "Verify: Aborted analysis of function '" << functionName << "': " << e.what() << std::endl; + } catch (const TerminateExpression &) { + break; } } }