Skip to content

Commit e34b2a3

Browse files
committed
Use direct token checks for string prefixes
1 parent 2a0c507 commit e34b2a3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎lib/astutils.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,8 +1609,8 @@ bool isSameExpression(bool macro, const Token *tok1, const Token *tok2, const Se
16091609
return false;
16101610
// An unknown string-prefix macro leaves the literal outside the AST.
16111611
// Compare the literal text as well so identical literals still compare equal.
1612-
const bool stringPrefix1 = !tok1->isKeyword() && Token::Match(tok1, "%name% %str%");
1613-
const bool stringPrefix2 = !tok2->isKeyword() && Token::Match(tok2, "%name% %str%");
1612+
const bool stringPrefix1 = tok1->isName() && !tok1->isKeyword() && tok1->next() && tok1->next()->tokType() == Token::eString;
1613+
const bool stringPrefix2 = tok2->isName() && !tok2->isKeyword() && tok2->next() && tok2->next()->tokType() == Token::eString;
16141614
if (stringPrefix1 || stringPrefix2) {
16151615
if (!stringPrefix1 || !stringPrefix2)
16161616
return false;

0 commit comments

Comments
 (0)