Skip to content

Commit

Permalink
Revert "tokenlist::iscast(): save a few pointer dereferences."
Browse files Browse the repository at this point in the history
This reverts commit e187fdb.
  • Loading branch information
matthiaskrgr committed Jun 2, 2018
1 parent d3b2312 commit 0771a81
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/tokenlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,10 @@ static bool iscast(const Token *tok)
if (!Token::Match(tok, "( ::| %name%"))
return false;

const Token *prevTok = tok->previous();
if (prevTok && prevTok->isName() && prevTok->str() != "return")
if (tok->previous() && tok->previous()->isName() && tok->previous()->str() != "return")
return false;

if (Token::simpleMatch(prevTok, ">") && prevTok->link())
if (Token::simpleMatch(tok->previous(), ">") && tok->previous()->link())
return false;

if (Token::Match(tok, "( (| typeof (") && Token::Match(tok->link(), ") %num%"))
Expand All @@ -407,7 +406,7 @@ static bool iscast(const Token *tok)
if (Token::Match(tok->link(), ") %cop%") && !Token::Match(tok->link(), ") [&*+-~]"))
return false;

if (Token::Match(prevTok, "= ( %name% ) {") && tok->next()->varId() == 0)
if (Token::Match(tok->previous(), "= ( %name% ) {") && tok->next()->varId() == 0)
return true;

bool type = false;
Expand Down

0 comments on commit 0771a81

Please sign in to comment.