Skip to content

Commit 4792e84

Browse files
committed
Token: avoid maximum token value bailout until values are actually being added [skip ci]
1 parent 5d5f552 commit 4792e84

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

lib/token.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2238,13 +2238,6 @@ bool Token::addValue(const ValueFlow::Value &value)
22382238
return false; // TODO: add bailout message
22392239

22402240
if (mImpl->mValues) {
2241-
// Don't handle more than 10 values for performance reasons
2242-
// TODO: add setting?
2243-
if (mImpl->mValues->size() >= 10U) {
2244-
debugMsg("maxTokenValueBailout", "exceeded maximum amount of values per token");
2245-
return false;
2246-
}
2247-
22482241
// if value already exists, don't add it again
22492242
auto it = mImpl->mValues->begin();
22502243
for (; it != mImpl->mValues->end(); ++it) {
@@ -2276,6 +2269,13 @@ bool Token::addValue(const ValueFlow::Value &value)
22762269

22772270
// Add value
22782271
if (it == mImpl->mValues->end()) {
2272+
// Don't handle more than 10 values for performance reasons
2273+
// TODO: add setting?
2274+
if (mImpl->mValues->size() >= 10U) {
2275+
debugMsg("maxTokenValueBailout", "exceeded maximum amount of values per token");
2276+
return false;
2277+
}
2278+
22792279
ValueFlow::Value v(value);
22802280
if (v.varId == 0)
22812281
v.varId = mImpl->mVarId;

0 commit comments

Comments
 (0)