Minor improvement to removeReduntantConditions()
This commit is contained in:
parent
36f39aec22
commit
05e23b7606
26
tokenize.cpp
26
tokenize.cpp
|
@ -1078,30 +1078,16 @@ bool Tokenizer::removeReduntantConditions()
|
||||||
|
|
||||||
for ( TOKEN *tok = _tokens; tok; tok = tok->next() )
|
for ( TOKEN *tok = _tokens; tok; tok = tok->next() )
|
||||||
{
|
{
|
||||||
if (!TOKEN::Match(tok, "if ( %bool% )"))
|
if (!TOKEN::Match(tok, "if ( %bool% ) {"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Find matching else
|
// Find matching else
|
||||||
const TOKEN *elseTag = 0;
|
const TOKEN *elseTag = 0;
|
||||||
if( TOKEN::simpleMatch( tok->tokAt( 4 ), "{" ) )
|
|
||||||
{
|
// Find the closing "}"
|
||||||
// Find the closing "}"
|
elseTag = Tokenizer::findClosing( tok->tokAt( 4 ) );
|
||||||
elseTag = Tokenizer::findClosing( tok->tokAt( 4 ) );
|
if( elseTag )
|
||||||
if( elseTag )
|
elseTag = elseTag->next();
|
||||||
elseTag = elseTag->next();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Find the closing ";"
|
|
||||||
for ( const TOKEN *closing = tok->tokAt( 4 ); closing; closing = closing->next() )
|
|
||||||
{
|
|
||||||
if( closing->str() == ";" )
|
|
||||||
{
|
|
||||||
elseTag = closing->next();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool boolValue = false;
|
bool boolValue = false;
|
||||||
if( tok->tokAt( 2 )->str() == "true" )
|
if( tok->tokAt( 2 )->str() == "true" )
|
||||||
|
|
Loading…
Reference in New Issue