From f449e91d4388e2c899140015838c0e82383c2d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 27 Jul 2015 14:57:02 +0200 Subject: [PATCH] made valueFlowSwitchVariable faster when there are many 'case %num%:' --- lib/valueflow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index fb88f6e81..2ab272dc3 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -2020,8 +2020,10 @@ static void valueFlowSwitchVariable(TokenList *tokenlist, SymbolDatabase* symbol if (Token::Match(tok, "case %num% :")) { std::list values; values.push_back(ValueFlow::Value(MathLib::toLongNumber(tok->next()->str()))); - while (Token::Match(tok->tokAt(3), "case %num% :")) { + while (Token::Match(tok->tokAt(3), ";| case %num% :")) { tok = tok->tokAt(3); + if (!tok->isName()) + tok = tok->next(); values.push_back(ValueFlow::Value(MathLib::toLongNumber(tok->next()->str()))); } for (std::list::const_iterator val = values.begin(); val != values.end(); ++val) {