use std::string::empty() (#3910)
This commit is contained in:
parent
0636018df3
commit
25ef9eeb26
|
@ -637,7 +637,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
||||||
mSettings->platform(Settings::Unix64);
|
mSettings->platform(Settings::Unix64);
|
||||||
else if (platform == "native")
|
else if (platform == "native")
|
||||||
mSettings->platform(Settings::Native);
|
mSettings->platform(Settings::Native);
|
||||||
else if (platform == "unspecified" || platform == "Unspecified" || platform == "")
|
else if (platform == "unspecified" || platform == "Unspecified" || platform.empty())
|
||||||
;
|
;
|
||||||
else if (!mSettings->loadPlatformFile(projectFile.c_str(), platform) && !mSettings->loadPlatformFile(argv[0], platform)) {
|
else if (!mSettings->loadPlatformFile(projectFile.c_str(), platform) && !mSettings->loadPlatformFile(argv[0], platform)) {
|
||||||
std::string message("unrecognized platform: \"");
|
std::string message("unrecognized platform: \"");
|
||||||
|
|
|
@ -755,7 +755,7 @@ const Token * CheckLeakAutoVar::checkTokenInsideExpression(const Token * const t
|
||||||
if (rhs->varId() == tok->varId()) {
|
if (rhs->varId() == tok->varId()) {
|
||||||
// simple assignment
|
// simple assignment
|
||||||
varInfo->erase(tok->varId());
|
varInfo->erase(tok->varId());
|
||||||
} else if (rhs->str() == "(" && mSettings->library.returnValue(rhs->astOperand1()) != emptyString) {
|
} else if (rhs->str() == "(" && !mSettings->library.returnValue(rhs->astOperand1()).empty()) {
|
||||||
// #9298, assignment through return value of a function
|
// #9298, assignment through return value of a function
|
||||||
const std::string &returnValue = mSettings->library.returnValue(rhs->astOperand1());
|
const std::string &returnValue = mSettings->library.returnValue(rhs->astOperand1());
|
||||||
if (returnValue.compare(0, 3, "arg") == 0) {
|
if (returnValue.compare(0, 3, "arg") == 0) {
|
||||||
|
|
|
@ -258,7 +258,7 @@ std::string Suppressions::addSuppressions(const std::list<Suppression> &suppress
|
||||||
{
|
{
|
||||||
for (const auto &newSuppression : suppressions) {
|
for (const auto &newSuppression : suppressions) {
|
||||||
auto errmsg = addSuppression(newSuppression);
|
auto errmsg = addSuppression(newSuppression);
|
||||||
if (errmsg != "")
|
if (!errmsg.empty())
|
||||||
return errmsg;
|
return errmsg;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -3439,7 +3439,7 @@ void Tokenizer::calculateScopes()
|
||||||
// New scope is opening, record it here
|
// New scope is opening, record it here
|
||||||
std::shared_ptr<ScopeInfo2> newScopeInfo = std::make_shared<ScopeInfo2>(tok->scopeInfo()->name, tok->link(), tok->scopeInfo()->usingNamespaces);
|
std::shared_ptr<ScopeInfo2> newScopeInfo = std::make_shared<ScopeInfo2>(tok->scopeInfo()->name, tok->link(), tok->scopeInfo()->usingNamespaces);
|
||||||
|
|
||||||
if (newScopeInfo->name != "" && nextScopeNameAddition != "")
|
if (!newScopeInfo->name.empty() && !nextScopeNameAddition.empty())
|
||||||
newScopeInfo->name.append(" :: ");
|
newScopeInfo->name.append(" :: ");
|
||||||
newScopeInfo->name.append(nextScopeNameAddition);
|
newScopeInfo->name.append(nextScopeNameAddition);
|
||||||
nextScopeNameAddition = "";
|
nextScopeNameAddition = "";
|
||||||
|
|
|
@ -4564,7 +4564,7 @@ static bool isOpenParenthesisMemberFunctionCallOfVarId(const Token * openParenth
|
||||||
{
|
{
|
||||||
const Token * varTok = openParenthesisToken->tokAt(-3);
|
const Token * varTok = openParenthesisToken->tokAt(-3);
|
||||||
return Token::Match(varTok, "%varid% . %name% (", varId) &&
|
return Token::Match(varTok, "%varid% . %name% (", varId) &&
|
||||||
varTok->next()->originalName() == emptyString;
|
varTok->next()->originalName().empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Token * findOpenParentesisOfMove(const Token * moveVarTok)
|
static const Token * findOpenParentesisOfMove(const Token * moveVarTok)
|
||||||
|
@ -4603,7 +4603,7 @@ static void valueFlowAfterMove(TokenList* tokenlist, SymbolDatabase* symboldatab
|
||||||
|
|
||||||
for (Token* tok = const_cast<Token*>(start); tok != scope->bodyEnd; tok = tok->next()) {
|
for (Token* tok = const_cast<Token*>(start); tok != scope->bodyEnd; tok = tok->next()) {
|
||||||
Token * varTok;
|
Token * varTok;
|
||||||
if (Token::Match(tok, "%var% . reset|clear (") && tok->next()->originalName() == emptyString) {
|
if (Token::Match(tok, "%var% . reset|clear (") && tok->next()->originalName().empty()) {
|
||||||
varTok = tok;
|
varTok = tok;
|
||||||
ValueFlow::Value value;
|
ValueFlow::Value value;
|
||||||
value.valueType = ValueFlow::Value::ValueType::MOVED;
|
value.valueType = ValueFlow::Value::ValueType::MOVED;
|
||||||
|
|
|
@ -2220,7 +2220,7 @@ private:
|
||||||
const Scope* f = db->findScopeByName("f");
|
const Scope* f = db->findScopeByName("f");
|
||||||
ASSERT(f && f->type == Scope::eFunction && f->function);
|
ASSERT(f && f->type == Scope::eFunction && f->function);
|
||||||
|
|
||||||
ASSERT(f->function->argumentList.size() == 2 && f->function->argumentList.front().index() == 0 && f->function->argumentList.front().name() == "" && f->function->argumentList.back().index() == 1);
|
ASSERT(f->function->argumentList.size() == 2 && f->function->argumentList.front().index() == 0 && f->function->argumentList.front().name().empty() && f->function->argumentList.back().index() == 1);
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
|
@ -88,7 +88,7 @@ private:
|
||||||
checkUnusedFunctions.parseTokens(tokenizer, "someFile.c", &settings);
|
checkUnusedFunctions.parseTokens(tokenizer, "someFile.c", &settings);
|
||||||
// check() returns error if and only if errout is not empty.
|
// check() returns error if and only if errout is not empty.
|
||||||
if ((checkUnusedFunctions.check)(this, settings)) {
|
if ((checkUnusedFunctions.check)(this, settings)) {
|
||||||
ASSERT(errout.str() != "");
|
ASSERT(!errout.str().empty());
|
||||||
} else {
|
} else {
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue