| 544 | } |
| 545 | |
| 546 | template<class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*> )> |
| 547 | static T* nextAfterAstRightmostLeafGeneric(T* tok) |
| 548 | { |
| 549 | T * rightmostLeaf = tok; |
| 550 | if (!rightmostLeaf || !rightmostLeaf->astOperand1()) |
| 551 | return nullptr; |
| 552 | do { |
| 553 | if (T* lam = findLambdaEndToken(rightmostLeaf)) { |
| 554 | rightmostLeaf = lam; |
| 555 | break; |
| 556 | } |
| 557 | if (rightmostLeaf->astOperand2() && precedes(rightmostLeaf, rightmostLeaf->astOperand2())) |
| 558 | rightmostLeaf = rightmostLeaf->astOperand2(); |
| 559 | else if (rightmostLeaf->astOperand1() && precedes(rightmostLeaf, rightmostLeaf->astOperand1())) |
| 560 | rightmostLeaf = rightmostLeaf->astOperand1(); |
| 561 | else |
| 562 | break; |
| 563 | } while (rightmostLeaf->astOperand1() || rightmostLeaf->astOperand2()); |
| 564 | while (Token::Match(rightmostLeaf->next(), "]|)") && !hasToken(rightmostLeaf->linkAt(1), rightmostLeaf->next(), tok)) |
| 565 | rightmostLeaf = rightmostLeaf->next(); |
| 566 | if (Token::Match(rightmostLeaf, "{|(|[") && rightmostLeaf->link()) |
| 567 | rightmostLeaf = rightmostLeaf->link(); |
| 568 | return rightmostLeaf->next(); |
| 569 | } |
| 570 | |
| 571 | const Token* nextAfterAstRightmostLeaf(const Token* tok) |
| 572 | { |
no test coverage detected