Don't show inconclusive message redundantCopyLocalConst if --inconclusive is not set.
Ran AStyle
This commit is contained in:
parent
87e6a3501a
commit
fb0d145b34
|
@ -2574,7 +2574,7 @@ static bool constructorTakesReference(const Scope * const classScope)
|
|||
//---------------------------------------------------------------------------
|
||||
void CheckOther::checkRedundantCopy()
|
||||
{
|
||||
if (!_settings->isEnabled("performance") || _tokenizer->isC())
|
||||
if (!_settings->isEnabled("performance") || _tokenizer->isC() || !_settings->inconclusive)
|
||||
return;
|
||||
|
||||
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||
|
|
|
@ -249,7 +249,7 @@ void CheckType::checkSignConversion()
|
|||
const Variable *var = tok1->variable();
|
||||
if (var && tok1->getValueLE(-1,_settings)) {
|
||||
bool signedvar = false;
|
||||
for (const Token *type = var->typeStartToken();;type = type->next()) {
|
||||
for (const Token *type = var->typeStartToken();; type = type->next()) {
|
||||
if (type->isSigned()) {
|
||||
signedvar = true;
|
||||
break;
|
||||
|
|
|
@ -5231,12 +5231,13 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void check_redundant_copy(const char code[]) {
|
||||
void check_redundant_copy(const char code[], bool inconclusive = true) {
|
||||
// Clear the error buffer..
|
||||
errout.str("");
|
||||
|
||||
Settings settings;
|
||||
settings.addEnabled("performance");
|
||||
settings.inconclusive = inconclusive;
|
||||
|
||||
// Tokenize..
|
||||
Tokenizer tokenizer(&settings, this);
|
||||
|
@ -5332,7 +5333,7 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #5618
|
||||
check_redundant_copy("class Token {\n"
|
||||
const char* code5618 = "class Token {\n"
|
||||
"public:\n"
|
||||
" const std::string& str();\n"
|
||||
"};\n"
|
||||
|
@ -5341,8 +5342,11 @@ private:
|
|||
" const std::string temp = tok->str();\n"
|
||||
" tok->str(tok->strAt(2));\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
"}";
|
||||
check_redundant_copy(code5618);
|
||||
TODO_ASSERT_EQUALS("", "[test.cpp:7]: (performance, inconclusive) Use const reference for 'temp' to avoid unnecessary data copying.\n", errout.str());
|
||||
check_redundant_copy(code5618, false);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #5890 - crash: wesnoth desktop_util.cpp / unicode.hpp
|
||||
check_redundant_copy("typedef std::vector<char> X;\n"
|
||||
|
|
Loading…
Reference in New Issue