Fixed #6730 (ValueFlow: inner scope does not return (continue,throw))
This commit is contained in:
parent
7a0da68843
commit
2e78d21480
|
@ -262,7 +262,7 @@ static bool isReturn(const Token *tok)
|
|||
return true;
|
||||
// return/goto statement
|
||||
prev = prev->previous();
|
||||
while (prev && !Token::Match(prev, ";|{|}|return|goto|throw"))
|
||||
while (prev && !Token::Match(prev, ";|{|}|return|goto|throw|continue|break"))
|
||||
prev = prev->previous();
|
||||
return prev && prev->isName();
|
||||
}
|
||||
|
|
|
@ -1283,6 +1283,14 @@ private:
|
|||
"}";
|
||||
ASSERT_EQUALS(false, testValueOfX(code, 5U, 5));
|
||||
|
||||
code = "void f(int x) {\n" // #6730
|
||||
" if (x == 5) {\n"
|
||||
" if (z) continue; else throw e;\n"
|
||||
" }\n"
|
||||
" a = x;\n"
|
||||
"}";
|
||||
ASSERT_EQUALS(false, testValueOfX(code, 5U, 5));
|
||||
|
||||
// TODO: float
|
||||
code = "void f(float x) {\n"
|
||||
" if (x == 0.5) {}\n"
|
||||
|
|
Loading…
Reference in New Issue