Skip to content

Commit a9db06c

Browse files
committed
longCast: Only warn when original name is 'long'. avoids some FPs when typedef types are used.
1 parent c0b33d2 commit a9db06c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/checktype.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ void CheckType::checkLongCast()
315315
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
316316
if (!Token::Match(tok, "%var% ="))
317317
continue;
318-
if (!tok->variable() || !tok->variable()->isConst() || tok->variable()->typeStartToken()->str() != "long")
318+
if (!tok->variable() || !tok->variable()->isConst() || tok->variable()->typeStartToken()->originalName() != "long")
319319
continue;
320320
if (Token::Match(tok->next()->astOperand2(), "*|<<") && astIsIntResult(tok->next()->astOperand2()))
321321
longCastAssignError(tok);
@@ -331,7 +331,7 @@ void CheckType::checkLongCast()
331331
const Token * def = scope->classDef;
332332
bool islong = false;
333333
while (Token::Match(def, "%type%|::")) {
334-
if (def->str() == "long") {
334+
if (def->originalName() == "long") {
335335
islong = true;
336336
break;
337337
}

0 commit comments

Comments
 (0)