Refactoring: Remove duplicate function from tokenizer: code_is_c() -> isC()
This commit is contained in:
parent
614c90b156
commit
90e1a397a2
|
@ -155,7 +155,7 @@ void CheckOther::clarifyCondition()
|
|||
tok2 = tok2->link();
|
||||
else if (Token::Match(tok2, "<|<=|==|!=|>|>=")) {
|
||||
// This might be a template
|
||||
if (!_tokenizer->code_is_c() && Token::Match(tok2->previous(), "%var% <"))
|
||||
if (!_tokenizer->isC() && Token::Match(tok2->previous(), "%var% <"))
|
||||
break;
|
||||
|
||||
clarifyConditionError(tok, tok->strAt(2) == "=", false);
|
||||
|
@ -2246,7 +2246,7 @@ static bool isFunction(const std::string &name, const Token *startToken)
|
|||
void CheckOther::checkMisusedScopedObject()
|
||||
{
|
||||
// Skip this check for .c files
|
||||
if (_tokenizer->code_is_c()) {
|
||||
if (_tokenizer->isC()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -5674,7 +5674,7 @@ void Tokenizer::simplifyFunctionParameters()
|
|||
|
||||
void Tokenizer::simplifyPointerToStandardType()
|
||||
{
|
||||
if (!code_is_c())
|
||||
if (!isC())
|
||||
return;
|
||||
|
||||
for (Token *tok = _tokens; tok; tok = tok->next()) {
|
||||
|
@ -10086,17 +10086,3 @@ void Tokenizer::printUnknownTypes()
|
|||
_errorLogger->reportOut(ss.str());
|
||||
}
|
||||
}
|
||||
|
||||
bool Tokenizer::code_is_c() const
|
||||
{
|
||||
const std::string fname = getFiles()->at(0);
|
||||
const size_t position = fname.rfind(".");
|
||||
|
||||
if (position != std::string::npos) {
|
||||
const std::string ext = fname.substr(position);
|
||||
if (ext == ".c" || ext == ".C")
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -792,9 +792,6 @@ public:
|
|||
*/
|
||||
void printUnknownTypes();
|
||||
|
||||
/** Checks if the file extensions is .c or .C */
|
||||
bool code_is_c() const;
|
||||
|
||||
private:
|
||||
/** Disable copy constructor, no implementation */
|
||||
Tokenizer(const Tokenizer &);
|
||||
|
|
Loading…
Reference in New Issue