SymbolDatabase: better handling when array size is given with expression involving enum constants.
This commit is contained in:
parent
1d21cf5755
commit
5631c765a7
|
@ -1289,6 +1289,20 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
|||
dimension.num = dimension.end->enumerator()->value;
|
||||
dimension.known = true;
|
||||
}
|
||||
} else {
|
||||
// rhs of [
|
||||
const Token *rhs = dimension.start->previous()->astOperand2();
|
||||
|
||||
if (rhs) {
|
||||
// constant folding of expression:
|
||||
ValueFlow::valueFlowConstantFoldAST(rhs);
|
||||
|
||||
// get constant folded value:
|
||||
if (rhs->values.size() == 1U && rhs->values.front().isKnown()) {
|
||||
dimension.num = rhs->values.front().intvalue;
|
||||
dimension.known = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue