Code cleanup
This commit is contained in:
parent
7d12951da0
commit
9b685ba3c3
|
@ -136,8 +136,11 @@ void CheckAssignIf::multiCondition()
|
|||
if (!_settings->isEnabled("style"))
|
||||
return;
|
||||
|
||||
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
|
||||
if (Token::Match(tok, "if ( %var% & %num% ) {")) {
|
||||
const SymbolDatabase* const symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||
|
||||
for (std::list<Scope>::const_iterator i = symbolDatabase->scopeList.begin(); i != symbolDatabase->scopeList.end(); ++i) {
|
||||
if (i->type == Scope::eIf && Token::Match(i->classDef, "if ( %var% & %num% ) {")) {
|
||||
const Token* const tok = i->classDef;
|
||||
const unsigned int varid(tok->tokAt(2)->varId());
|
||||
if (varid == 0)
|
||||
continue;
|
||||
|
|
|
@ -51,7 +51,6 @@ private:
|
|||
Tokenizer tokenizer(&settings, this);
|
||||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
tokenizer.setVarId();
|
||||
|
||||
// Check char variable usage..
|
||||
Check64BitPortability check64BitPortability(&tokenizer, &settings, this);
|
||||
|
|
|
@ -49,7 +49,6 @@ private:
|
|||
Tokenizer tokenizer(&settings, this);
|
||||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
tokenizer.setVarId();
|
||||
tokenizer.simplifyTokenList();
|
||||
|
||||
// Check char variable usage..
|
||||
|
|
|
@ -51,9 +51,6 @@ private:
|
|||
|
||||
tokenizer.simplifyTokenList();
|
||||
|
||||
// Assign variable ids
|
||||
tokenizer.setVarId();
|
||||
|
||||
// Check auto variables
|
||||
checkAutoVariables.autoVariables();
|
||||
checkAutoVariables.returnPointerToLocalArray();
|
||||
|
|
|
@ -54,7 +54,6 @@ private:
|
|||
Tokenizer tokenizer(&settings, this);
|
||||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
tokenizer.setVarId();
|
||||
|
||||
// Check char variable usage..
|
||||
CheckOther checkOther(&tokenizer, &settings, this);
|
||||
|
|
|
@ -48,7 +48,6 @@ private:
|
|||
Tokenizer tokenizer(&settings, this);
|
||||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
tokenizer.setVarId();
|
||||
|
||||
return ((const CheckMemoryLeak *)0)->functionReturnType(tokenizer.tokens());
|
||||
}
|
||||
|
@ -132,7 +131,6 @@ private:
|
|||
Tokenizer tokenizer(&settings, this);
|
||||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
tokenizer.setVarId();
|
||||
tokenizer.simplifyTokenList();
|
||||
|
||||
// Check for memory leaks..
|
||||
|
@ -3077,7 +3075,6 @@ private:
|
|||
Tokenizer tokenizer(&settings, this);
|
||||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
tokenizer.setVarId();
|
||||
tokenizer.simplifyTokenList();
|
||||
|
||||
// Check for memory leaks..
|
||||
|
@ -3784,7 +3781,6 @@ private:
|
|||
Tokenizer tokenizer(&settings, this);
|
||||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
tokenizer.setVarId();
|
||||
tokenizer.simplifyTokenList();
|
||||
|
||||
// Check for memory leaks..
|
||||
|
|
|
@ -51,9 +51,6 @@ private:
|
|||
tokenizer.tokenize(istr, "test.cpp");
|
||||
tokenizer.simplifyTokenList();
|
||||
|
||||
// Assign variable ids
|
||||
tokenizer.setVarId();
|
||||
|
||||
// Check for non reentrant functions..
|
||||
CheckNonReentrantFunctions checkNonReentrantFunctions(&tokenizer, &settings, this);
|
||||
checkNonReentrantFunctions.nonReentrantFunctions();
|
||||
|
|
|
@ -83,9 +83,6 @@ private:
|
|||
tokenizer.tokenize(istr, "test.cpp");
|
||||
tokenizer.simplifyTokenList();
|
||||
|
||||
// Assign variable ids
|
||||
tokenizer.setVarId();
|
||||
|
||||
// Check for obsolete functions..
|
||||
CheckObsoleteFunctions checkObsoleteFunctions(&tokenizer, &settings, this);
|
||||
checkObsoleteFunctions.obsoleteFunctions();
|
||||
|
|
|
@ -371,7 +371,6 @@ private:
|
|||
Tokenizer tokenizer(&settings, this);
|
||||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
tokenizer.setVarId();
|
||||
|
||||
//tokenizer.tokens()->printOut( "tokens" );
|
||||
|
||||
|
@ -437,7 +436,6 @@ private:
|
|||
Tokenizer tokenizer(&settings, this);
|
||||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
tokenizer.setVarId();
|
||||
|
||||
// Check for redundant code..
|
||||
CheckOther checkOther(&tokenizer, &settings, this);
|
||||
|
@ -718,12 +716,10 @@ private:
|
|||
Tokenizer tokenizerCpp(&settings, this);
|
||||
std::istringstream istr(code);
|
||||
tokenizerCpp.tokenize(istr, "test.cpp");
|
||||
tokenizerCpp.setVarId();
|
||||
|
||||
Tokenizer tokenizerC(&settings, this);
|
||||
std::istringstream istr2(code);
|
||||
tokenizerC.tokenize(istr2, "test.c");
|
||||
tokenizerC.setVarId();
|
||||
|
||||
CheckOther checkOtherCpp(&tokenizerCpp, &settings, this);
|
||||
checkOtherCpp.warningOldStylePointerCast();
|
||||
|
|
|
@ -48,9 +48,6 @@ private:
|
|||
tokenizer.tokenize(istr, "test.cpp");
|
||||
tokenizer.simplifyTokenList();
|
||||
|
||||
// Assign variable ids
|
||||
tokenizer.setVarId();
|
||||
|
||||
// Check for postfix operators..
|
||||
CheckPostfixOperator checkPostfixOperator(&tokenizer, &settings, this);
|
||||
checkPostfixOperator.postfixOperator();
|
||||
|
|
|
@ -873,7 +873,6 @@ private:
|
|||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
|
||||
tokenizer.setVarId();
|
||||
if (simplify)
|
||||
tokenizer.simplifyTokenList();
|
||||
|
||||
|
|
|
@ -1048,7 +1048,6 @@ private:
|
|||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
|
||||
tokenizer.setVarId();
|
||||
tokenizer.simplifyKnownVariables();
|
||||
|
||||
std::ostringstream ostr;
|
||||
|
@ -4151,7 +4150,6 @@ private:
|
|||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
|
||||
tokenizer.setVarId();
|
||||
tokenizer.simplifyTokenList();
|
||||
|
||||
std::ostringstream ostr;
|
||||
|
@ -4178,7 +4176,6 @@ private:
|
|||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
|
||||
tokenizer.setVarId();
|
||||
tokenizer.simplifyTokenList();
|
||||
|
||||
std::ostringstream ostr;
|
||||
|
|
Loading…
Reference in New Issue