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();
|
tok2 = tok2->link();
|
||||||
else if (Token::Match(tok2, "<|<=|==|!=|>|>=")) {
|
else if (Token::Match(tok2, "<|<=|==|!=|>|>=")) {
|
||||||
// This might be a template
|
// This might be a template
|
||||||
if (!_tokenizer->code_is_c() && Token::Match(tok2->previous(), "%var% <"))
|
if (!_tokenizer->isC() && Token::Match(tok2->previous(), "%var% <"))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
clarifyConditionError(tok, tok->strAt(2) == "=", false);
|
clarifyConditionError(tok, tok->strAt(2) == "=", false);
|
||||||
|
@ -2246,7 +2246,7 @@ static bool isFunction(const std::string &name, const Token *startToken)
|
||||||
void CheckOther::checkMisusedScopedObject()
|
void CheckOther::checkMisusedScopedObject()
|
||||||
{
|
{
|
||||||
// Skip this check for .c files
|
// Skip this check for .c files
|
||||||
if (_tokenizer->code_is_c()) {
|
if (_tokenizer->isC()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5674,7 +5674,7 @@ void Tokenizer::simplifyFunctionParameters()
|
||||||
|
|
||||||
void Tokenizer::simplifyPointerToStandardType()
|
void Tokenizer::simplifyPointerToStandardType()
|
||||||
{
|
{
|
||||||
if (!code_is_c())
|
if (!isC())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Token *tok = _tokens; tok; tok = tok->next()) {
|
for (Token *tok = _tokens; tok; tok = tok->next()) {
|
||||||
|
@ -10086,17 +10086,3 @@ void Tokenizer::printUnknownTypes()
|
||||||
_errorLogger->reportOut(ss.str());
|
_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();
|
void printUnknownTypes();
|
||||||
|
|
||||||
/** Checks if the file extensions is .c or .C */
|
|
||||||
bool code_is_c() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Disable copy constructor, no implementation */
|
/** Disable copy constructor, no implementation */
|
||||||
Tokenizer(const Tokenizer &);
|
Tokenizer(const Tokenizer &);
|
||||||
|
|
Loading…
Reference in New Issue