Skip to content

Commit cc1faad

Browse files
committed
Removed bailouts in CheckClass::privateFunctions and CheckUnusedFunctions when checking code with templates (unnecessary after 2c10e9a)
1 parent 2c10e9a commit cc1faad

3 files changed

Lines changed: 2 additions & 17 deletions

File tree

lib/checkclass.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -583,11 +583,6 @@ void CheckClass::privateFunctions()
583583
if (!_settings->isEnabled("style"))
584584
return;
585585

586-
// don't check code that contains templates. Templates that are
587-
// "unused" are removed from the code. #2067
588-
if (_tokenizer->codeWithTemplates())
589-
return;
590-
591586
for (std::list<Scope>::const_iterator scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) {
592587
// only check classes and structures
593588
if (!scope->isClassOrStruct())

lib/checkunusedfunctions.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333

3434
void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer)
3535
{
36-
// if there are templates there might be false positives
37-
templates |= tokenizer.codeWithTemplates();
38-
if (templates)
39-
return;
40-
4136
// Function declarations..
4237
for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next()) {
4338
if (tok->fileIndex() != 0)
@@ -142,9 +137,6 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer)
142137

143138
void CheckUnusedFunctions::check(ErrorLogger * const errorLogger)
144139
{
145-
if (templates)
146-
return;
147-
148140
for (std::map<std::string, FunctionUsage>::const_iterator it = _functions.begin(); it != _functions.end(); ++it) {
149141
const FunctionUsage &func = it->second;
150142
if (func.usedOtherFile || func.filename.empty())

lib/checkunusedfunctions.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
class CPPCHECKLIB CheckUnusedFunctions: public Check {
3434
public:
3535
/** @brief This constructor is used when registering the CheckUnusedFunctions */
36-
CheckUnusedFunctions() : Check(myName()), templates(false)
36+
CheckUnusedFunctions() : Check(myName())
3737
{ }
3838

3939
/** @brief This constructor is used when running checks. */
4040
CheckUnusedFunctions(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
41-
: Check(myName(), tokenizer, settings, errorLogger), templates(false)
41+
: Check(myName(), tokenizer, settings, errorLogger)
4242
{ }
4343

4444
// Parse current tokens and determine..
@@ -89,8 +89,6 @@ class CPPCHECKLIB CheckUnusedFunctions: public Check {
8989
};
9090

9191
std::map<std::string, FunctionUsage> _functions;
92-
93-
bool templates;
9492
};
9593
/// @}
9694
//---------------------------------------------------------------------------

0 commit comments

Comments
 (0)