Skip to content

Commit

Permalink
symboldatabase.cpp: split logic in Variable::arrayDimensions()
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Jan 18, 2025
1 parent 891d6ee commit e89c24a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3734,9 +3734,13 @@ bool Variable::arrayDimensions(const Settings& settings, bool& isContainer)
// TODO: only perform when ValueFlow is enabled
// TODO: collect timing information for this call?
ValueFlow::valueFlowConstantFoldAST(const_cast<Token *>(dimension_.tok), settings);
if (dimension_.tok && (dimension_.tok->hasKnownIntValue() ||
(dimension_.tok->isTemplateArg() && !dimension_.tok->values().empty()))) {
dimension_.num = dimension_.tok->getKnownIntValue();
if (dimension_.tok) {
if (dimension_.tok->hasKnownIntValue())
dimension_.num = dimension_.tok->getKnownIntValue();
else if (dimension_.tok->isTemplateArg() && !dimension_.tok->values().empty()) {
assert(dimension_.tok->values().front().isKnown());
dimension_.num = dimension_.tok->values().front().intvalue;
}
dimension_.known = true;
}
}
Expand Down

0 comments on commit e89c24a

Please sign in to comment.