Refactoring: Replace names with underscores with camelCase names
This commit is contained in:
parent
02298bf4d9
commit
cf3f8c2f38
|
@ -290,26 +290,26 @@ void CheckBool::checkComparisonOfBoolWithBool()
|
||||||
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
|
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
|
||||||
if (tok->type() != Token::eComparisonOp || tok->str() == "==" || tok->str() == "!=")
|
if (tok->type() != Token::eComparisonOp || tok->str() == "==" || tok->str() == "!=")
|
||||||
continue;
|
continue;
|
||||||
bool first_token_bool = false;
|
bool firstTokenBool = false;
|
||||||
|
|
||||||
const Token *first_token = tok->previous();
|
const Token *firstToken = tok->previous();
|
||||||
if (first_token->varId()) {
|
if (firstToken->varId()) {
|
||||||
if (isBool(first_token->variable())) {
|
if (isBool(firstToken->variable())) {
|
||||||
first_token_bool = true;
|
firstTokenBool = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!first_token_bool)
|
if (!firstTokenBool)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool second_token_bool = false;
|
bool secondTokenBool = false;
|
||||||
const Token *second_token = tok->next();
|
const Token *secondToken = tok->next();
|
||||||
if (second_token->varId()) {
|
if (secondToken->varId()) {
|
||||||
if (isBool(second_token->variable())) {
|
if (isBool(secondToken->variable())) {
|
||||||
second_token_bool = true;
|
secondTokenBool = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (second_token_bool) {
|
if (secondTokenBool) {
|
||||||
comparisonOfBoolWithBoolError(first_token->next(), first_token->str());
|
comparisonOfBoolWithBoolError(firstToken->next(), secondToken->str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,18 +34,18 @@ void CheckBoost::checkBoostForeachModification()
|
||||||
if (!Token::simpleMatch(tok, "BOOST_FOREACH ("))
|
if (!Token::simpleMatch(tok, "BOOST_FOREACH ("))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const Token *container_tok = tok->next()->link()->previous();
|
const Token *containerTok = tok->next()->link()->previous();
|
||||||
if (!Token::Match(container_tok, "%var% ) {"))
|
if (!Token::Match(containerTok, "%var% ) {"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const unsigned int container_id = container_tok->varId();
|
const unsigned int containerId = containerTok->varId();
|
||||||
if (container_id == 0)
|
if (containerId == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const Token *tok2 = container_tok->tokAt(2);
|
const Token *tok2 = containerTok->tokAt(2);
|
||||||
const Token *end = tok2->link();
|
const Token *end = tok2->link();
|
||||||
for (; tok2 != end; tok2 = tok2->next()) {
|
for (; tok2 != end; tok2 = tok2->next()) {
|
||||||
if (Token::Match(tok2, "%varid% . insert|erase|push_back|push_front|pop_front|pop_back|clear|swap|resize|assign|merge|remove|remove_if|reverse|sort|splice|unique|pop|push", container_id)) {
|
if (Token::Match(tok2, "%varid% . insert|erase|push_back|push_front|pop_front|pop_back|clear|swap|resize|assign|merge|remove|remove_if|reverse|sort|splice|unique|pop|push", containerId)) {
|
||||||
const Token* nextStatement = Token::findsimplematch(tok2->linkAt(3), ";", end);
|
const Token* nextStatement = Token::findsimplematch(tok2->linkAt(3), ";", end);
|
||||||
if (!Token::Match(nextStatement, "; break|return|throw"))
|
if (!Token::Match(nextStatement, "; break|return|throw"))
|
||||||
boostForeachError(tok2);
|
boostForeachError(tok2);
|
||||||
|
|
|
@ -1116,12 +1116,12 @@ void CheckBufferOverrun::checkGlobalAndLocalVariable()
|
||||||
|
|
||||||
Token sizeTok(0);
|
Token sizeTok(0);
|
||||||
sizeTok.str(type);
|
sizeTok.str(type);
|
||||||
const MathLib::bigint total_size = size * static_cast<int>(_tokenizer->sizeOfType(&sizeTok));
|
const MathLib::bigint totalSize = size * static_cast<int>(_tokenizer->sizeOfType(&sizeTok));
|
||||||
if (total_size == 0)
|
if (totalSize == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
ArrayInfo temp(var->declarationId(), tok->next()->str(), total_size / size, size);
|
ArrayInfo temp(var->declarationId(), tok->next()->str(), totalSize / size, size);
|
||||||
checkScope(tok->tokAt(nextTok), v, temp);
|
checkScope(tok->tokAt(nextTok), v, temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5696,7 +5696,6 @@ void Tokenizer::simplifyPlatformTypes()
|
||||||
const Library::PlatformType * const platformtype = _settings->library.platform_type(tok->str(), platform_type);
|
const Library::PlatformType * const platformtype = _settings->library.platform_type(tok->str(), platform_type);
|
||||||
|
|
||||||
if (platformtype) {
|
if (platformtype) {
|
||||||
Token *type_token;
|
|
||||||
// check for namespace
|
// check for namespace
|
||||||
if (tok->strAt(-1) == "::") {
|
if (tok->strAt(-1) == "::") {
|
||||||
const Token * tok1 = tok->tokAt(-2);
|
const Token * tok1 = tok->tokAt(-2);
|
||||||
|
@ -5706,31 +5705,32 @@ void Tokenizer::simplifyPlatformTypes()
|
||||||
tok = tok->tokAt(-1);
|
tok = tok->tokAt(-1);
|
||||||
tok->deleteThis();
|
tok->deleteThis();
|
||||||
}
|
}
|
||||||
|
Token *typeToken;
|
||||||
if (platformtype->_const_ptr) {
|
if (platformtype->_const_ptr) {
|
||||||
tok->str("const");
|
tok->str("const");
|
||||||
tok->insertToken("*");
|
tok->insertToken("*");
|
||||||
tok->insertToken(platformtype->_type);
|
tok->insertToken(platformtype->_type);
|
||||||
type_token = tok;
|
typeToken = tok;
|
||||||
} else if (platformtype->_pointer) {
|
} else if (platformtype->_pointer) {
|
||||||
tok->str(platformtype->_type);
|
tok->str(platformtype->_type);
|
||||||
type_token = tok;
|
typeToken = tok;
|
||||||
tok->insertToken("*");
|
tok->insertToken("*");
|
||||||
} else if (platformtype->_ptr_ptr) {
|
} else if (platformtype->_ptr_ptr) {
|
||||||
tok->str(platformtype->_type);
|
tok->str(platformtype->_type);
|
||||||
type_token = tok;
|
typeToken = tok;
|
||||||
tok->insertToken("*");
|
tok->insertToken("*");
|
||||||
tok->insertToken("*");
|
tok->insertToken("*");
|
||||||
} else {
|
} else {
|
||||||
tok->originalName(tok->str());
|
tok->originalName(tok->str());
|
||||||
tok->str(platformtype->_type);
|
tok->str(platformtype->_type);
|
||||||
type_token = tok;
|
typeToken = tok;
|
||||||
}
|
}
|
||||||
if (platformtype->_signed)
|
if (platformtype->_signed)
|
||||||
type_token->isSigned(true);
|
typeToken->isSigned(true);
|
||||||
if (platformtype->_unsigned)
|
if (platformtype->_unsigned)
|
||||||
type_token->isUnsigned(true);
|
typeToken->isUnsigned(true);
|
||||||
if (platformtype->_long)
|
if (platformtype->_long)
|
||||||
type_token->isLong(true);
|
typeToken->isLong(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue