@@ -453,8 +453,8 @@ bool isTemporary(const Token* tok, const Library* library, bool unknown)
453453 return tok->valueType ()->reference == Reference::None && tok->valueType ()->pointer == 0 ;
454454 }
455455 const Token* ftok = nullptr ;
456- if (Token::simpleMatch (tok->previous (), " >" ) && tok->previous ()-> link ( ))
457- ftok = tok->previous ()-> link ( )->previous ();
456+ if (Token::simpleMatch (tok->previous (), " >" ) && tok->linkAt (- 1 ))
457+ ftok = tok->linkAt (- 1 )->previous ();
458458 else
459459 ftok = tok->previous ();
460460 if (!ftok)
@@ -538,7 +538,7 @@ static T* nextAfterAstRightmostLeafGeneric(T* tok)
538538 else
539539 break ;
540540 } while (rightmostLeaf->astOperand1 () || rightmostLeaf->astOperand2 ());
541- while (Token::Match (rightmostLeaf->next (), " ]|)" ) && !hasToken (rightmostLeaf->next ()-> link ( ), rightmostLeaf->next (), tok))
541+ while (Token::Match (rightmostLeaf->next (), " ]|)" ) && !hasToken (rightmostLeaf->linkAt ( 1 ), rightmostLeaf->next (), tok))
542542 rightmostLeaf = rightmostLeaf->next ();
543543 if (Token::Match (rightmostLeaf, " {|(|[" ) && rightmostLeaf->link ())
544544 rightmostLeaf = rightmostLeaf->link ();
@@ -568,7 +568,7 @@ Token* astParentSkipParens(Token* tok)
568568 if (parent->link () != nextAfterAstRightmostLeaf (tok))
569569 return parent;
570570 if (Token::Match (parent->previous (), " %name% (" ) ||
571- (Token::simpleMatch (parent->previous (), " > (" ) && parent->previous ()-> link ( )))
571+ (Token::simpleMatch (parent->previous (), " > (" ) && parent->linkAt (- 1 )))
572572 return parent;
573573 return astParentSkipParens (parent);
574574}
@@ -839,7 +839,7 @@ static T* getCondTokFromEndImpl(T* endBlock)
839839 if (Token::simpleMatch (startBlock->previous (), " do" ))
840840 return getCondTok (startBlock->previous ());
841841 if (Token::simpleMatch (startBlock->previous (), " )" ))
842- return getCondTok (startBlock->previous ()-> link ( ));
842+ return getCondTok (startBlock->linkAt (- 1 ));
843843 if (Token::simpleMatch (startBlock->tokAt (-2 ), " } else {" ))
844844 return getCondTokFromEnd (startBlock->tokAt (-2 ));
845845 return nullptr ;
@@ -1669,7 +1669,7 @@ bool isSameExpression(bool macro, const Token *tok1, const Token *tok2, const Se
16691669 if (!compareTokenFlags (tok1, tok2, macro))
16701670 return false ;
16711671
1672- if (pure && tok1->isName () && tok1->next ()-> str ( ) == " (" && tok1->str () != " sizeof" && !(tok1->variable () && tok1 == tok1->variable ()->nameToken ())) {
1672+ if (pure && tok1->isName () && tok1->strAt ( 1 ) == " (" && tok1->str () != " sizeof" && !(tok1->variable () && tok1 == tok1->variable ()->nameToken ())) {
16731673 if (!tok1->function ()) {
16741674 if (Token::simpleMatch (tok1->previous (), " ." )) {
16751675 const Token *lhs = tok1->previous ();
@@ -1694,11 +1694,11 @@ bool isSameExpression(bool macro, const Token *tok1, const Token *tok2, const Se
16941694 }
16951695 }
16961696 // templates/casts
1697- if ((tok1->next () && tok1->next ()-> link ( ) && Token::Match (tok1, " %name% <" )) ||
1698- (tok2->next () && tok2->next ()-> link ( ) && Token::Match (tok2, " %name% <" ))) {
1697+ if ((tok1->next () && tok1->linkAt ( 1 ) && Token::Match (tok1, " %name% <" )) ||
1698+ (tok2->next () && tok2->linkAt ( 1 ) && Token::Match (tok2, " %name% <" ))) {
16991699
17001700 // non-const template function that is not a dynamic_cast => return false
1701- if (pure && Token::simpleMatch (tok1->next ()-> link ( ), " > (" ) &&
1701+ if (pure && Token::simpleMatch (tok1->linkAt ( 1 ), " > (" ) &&
17021702 !(tok1->function () && tok1->function ()->isConst ()) &&
17031703 tok1->str () != " dynamic_cast" )
17041704 return false ;
@@ -1725,7 +1725,7 @@ bool isSameExpression(bool macro, const Token *tok1, const Token *tok2, const Se
17251725 // cast => assert that the casts are equal
17261726 if (tok1->str () == " (" && tok1->previous () &&
17271727 !tok1->previous ()->isName () &&
1728- !(tok1->previous ()-> str ( ) == " >" && tok1->previous ()-> link ( ))) {
1728+ !(tok1->strAt (- 1 ) == " >" && tok1->linkAt (- 1 ))) {
17291729 const Token *t1 = tok1->next ();
17301730 const Token *t2 = tok2->next ();
17311731 while (t1 && t2 &&
@@ -2052,7 +2052,7 @@ bool isConstExpression(const Token *tok, const Library& library)
20522052 return true ;
20532053 if (tok->variable () && tok->variable ()->isVolatile ())
20542054 return false ;
2055- if (tok->isName () && tok->next ()-> str ( ) == " (" ) {
2055+ if (tok->isName () && tok->strAt ( 1 ) == " (" ) {
20562056 if (!isConstFunctionCall (tok, library))
20572057 return false ;
20582058 }
@@ -2233,8 +2233,8 @@ bool isReturnScope(const Token* const endToken, const Library& library, const To
22332233 *unknownFunc = prev->previous ();
22342234 return false ;
22352235 }
2236- if (Token::simpleMatch (prev->previous (), " ) ;" ) && prev->previous ()-> link ( ) &&
2237- isEscaped (prev->previous ()-> link ( )->astTop (), functionScope, library))
2236+ if (Token::simpleMatch (prev->previous (), " ) ;" ) && prev->linkAt (- 1 ) &&
2237+ isEscaped (prev->linkAt (- 1 )->astTop (), functionScope, library))
22382238 return true ;
22392239 if (isEscaped (prev->previous ()->astTop (), functionScope, library))
22402240 return true ;
@@ -2740,7 +2740,7 @@ bool isVariableChanged(const Token *tok, int indirect, const Settings &settings,
27402740
27412741 // structured binding, nonconst reference variable in lhs
27422742 if (Token::Match (tok2->astParent (), " :|=" ) && tok2 == tok2->astParent ()->astOperand2 () && Token::simpleMatch (tok2->astParent ()->previous (), " ]" )) {
2743- const Token *typeStart = tok2->astParent ()->previous ()-> link ( )->previous ();
2743+ const Token *typeStart = tok2->astParent ()->linkAt (- 1 )->previous ();
27442744 if (Token::simpleMatch (typeStart, " &" ))
27452745 typeStart = typeStart->previous ();
27462746 if (typeStart && Token::Match (typeStart->previous (), " [;{}(] auto &| [" )) {
@@ -3095,7 +3095,7 @@ int numberOfArgumentsWithoutAst(const Token* start)
30953095 const Token* openBracket = start->next ();
30963096 while (Token::simpleMatch (openBracket, " )" ))
30973097 openBracket = openBracket->next ();
3098- if (openBracket && openBracket->str ()==" (" && openBracket->next () && openBracket->next ()-> str ( )!=" )" ) {
3098+ if (openBracket && openBracket->str ()==" (" && openBracket->next () && openBracket->strAt ( 1 )!=" )" ) {
30993099 const Token* argument=openBracket->next ();
31003100 while (argument) {
31013101 ++arguments;
@@ -3595,7 +3595,7 @@ bool isGlobalData(const Token *expr)
35953595 return ChildrenToVisit::none;
35963596 }
35973597 }
3598- if (tok->varId () == 0 && tok->isName () && tok->previous ()-> str ( ) != " ." ) {
3598+ if (tok->varId () == 0 && tok->isName () && tok->strAt (- 1 ) != " ." ) {
35993599 globalData = true ;
36003600 return ChildrenToVisit::none;
36013601 }
@@ -3609,7 +3609,7 @@ bool isGlobalData(const Token *expr)
36093609 globalData = true ;
36103610 return ChildrenToVisit::none;
36113611 }
3612- if (tok->previous ()-> str ( ) != " ." && !tok->variable ()->isLocal () && !tok->variable ()->isArgument ()) {
3612+ if (tok->strAt (- 1 ) != " ." && !tok->variable ()->isLocal () && !tok->variable ()->isArgument ()) {
36133613 globalData = true ;
36143614 return ChildrenToVisit::none;
36153615 }
0 commit comments