Removed bailouts in CheckClass::privateFunctions and CheckUnusedFunctions when checking code with templates (unnecessary after 2c10e9a6ca)

This commit is contained in:
PKEuS 2012-07-29 08:05:54 -07:00
parent 2c10e9a6ca
commit cc1faad34a
3 changed files with 2 additions and 17 deletions

View File

@ -583,11 +583,6 @@ void CheckClass::privateFunctions()
if (!_settings->isEnabled("style")) if (!_settings->isEnabled("style"))
return; return;
// don't check code that contains templates. Templates that are
// "unused" are removed from the code. #2067
if (_tokenizer->codeWithTemplates())
return;
for (std::list<Scope>::const_iterator scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) { for (std::list<Scope>::const_iterator scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) {
// only check classes and structures // only check classes and structures
if (!scope->isClassOrStruct()) if (!scope->isClassOrStruct())

View File

@ -33,11 +33,6 @@
void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer) void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer)
{ {
// if there are templates there might be false positives
templates |= tokenizer.codeWithTemplates();
if (templates)
return;
// Function declarations.. // Function declarations..
for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next()) { for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next()) {
if (tok->fileIndex() != 0) if (tok->fileIndex() != 0)
@ -142,9 +137,6 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer)
void CheckUnusedFunctions::check(ErrorLogger * const errorLogger) void CheckUnusedFunctions::check(ErrorLogger * const errorLogger)
{ {
if (templates)
return;
for (std::map<std::string, FunctionUsage>::const_iterator it = _functions.begin(); it != _functions.end(); ++it) { for (std::map<std::string, FunctionUsage>::const_iterator it = _functions.begin(); it != _functions.end(); ++it) {
const FunctionUsage &func = it->second; const FunctionUsage &func = it->second;
if (func.usedOtherFile || func.filename.empty()) if (func.usedOtherFile || func.filename.empty())

View File

@ -33,12 +33,12 @@
class CPPCHECKLIB CheckUnusedFunctions: public Check { class CPPCHECKLIB CheckUnusedFunctions: public Check {
public: public:
/** @brief This constructor is used when registering the CheckUnusedFunctions */ /** @brief This constructor is used when registering the CheckUnusedFunctions */
CheckUnusedFunctions() : Check(myName()), templates(false) CheckUnusedFunctions() : Check(myName())
{ } { }
/** @brief This constructor is used when running checks. */ /** @brief This constructor is used when running checks. */
CheckUnusedFunctions(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) CheckUnusedFunctions(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger), templates(false) : Check(myName(), tokenizer, settings, errorLogger)
{ } { }
// Parse current tokens and determine.. // Parse current tokens and determine..
@ -89,8 +89,6 @@ private:
}; };
std::map<std::string, FunctionUsage> _functions; std::map<std::string, FunctionUsage> _functions;
bool templates;
}; };
/// @} /// @}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------