Valueflow: support global static const variables (#1861)
This commit is contained in:
parent
090fa255e8
commit
d1d622b74c
|
@ -1470,7 +1470,6 @@ static void valueFlowGlobalConstVar(TokenList* tokenList, const Settings *settin
|
|||
continue;
|
||||
// Initialization...
|
||||
if (tok == tok->variable()->nameToken() &&
|
||||
!tok->variable()->isStatic() &&
|
||||
!tok->variable()->isVolatile() &&
|
||||
!tok->variable()->isArgument() &&
|
||||
tok->variable()->isConst() &&
|
||||
|
|
|
@ -3265,6 +3265,10 @@ private:
|
|||
code = "volatile const int x = 42;\n"
|
||||
"void f(){ int a = x; }\n";
|
||||
ASSERT_EQUALS(false, testValueOfXKnown(code, 2U, 42));
|
||||
|
||||
code = "static const int x = 42;\n"
|
||||
"void f(){ int a = x; }\n";
|
||||
ASSERT_EQUALS(true, testValueOfX(code, 2U, 42));
|
||||
}
|
||||
|
||||
void valueFlowGlobalStaticVar() {
|
||||
|
|
Loading…
Reference in New Issue