Skip to content

Commit 46f726c

Browse files
committed
Cache and reuse value
1 parent 539258f commit 46f726c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/tokenize.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,9 +1153,12 @@ void Tokenizer::simplifyTypedef()
11531153
int back = int(classLevel) - 1;
11541154
bool good = true;
11551155
// check for extra qualification
1156-
while (back >= 0 && Token::Match(start->tokAt(-2), "%type% ::")) {
1157-
if (start->strAt(-2) == spaceInfo[back].className) {
1158-
start = start->tokAt(-2);
1156+
while (back >= 0) {
1157+
const Token *qualificationTok = start->tokAt(-2);
1158+
if (!Token::Match(qualificationTok, "%type% ::")
1159+
break;
1160+
if (qualificationTok->str() == spaceInfo[back].className) {
1161+
start = qualificationTok;
11591162
back--;
11601163
count++;
11611164
} else {

0 commit comments

Comments
 (0)