Skip to content

Commit 44fcbcc

Browse files
committed
removed usage of emptyString which would lead to a copy
1 parent 289f40d commit 44fcbcc

7 files changed

+12
-12
lines changed

lib/checkunusedfunctions.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ static void staticFunctionError(ErrorLogger& errorLogger,
351351
locationList.back().fileIndex = fileIndex;
352352
}
353353

354-
const ErrorMessage errmsg(std::move(locationList), emptyString, Severity::style, "$symbol:" + funcname + "\nThe function '$symbol' should have static linkage since it is not used outside of its translation unit.", "staticFunction", Certainty::normal);
354+
const ErrorMessage errmsg(std::move(locationList), "", Severity::style, "$symbol:" + funcname + "\nThe function '$symbol' should have static linkage since it is not used outside of its translation unit.", "staticFunction", Certainty::normal);
355355
errorLogger.reportErr(errmsg);
356356
}
357357

@@ -412,7 +412,7 @@ void CheckUnusedFunctions::unusedFunctionError(ErrorLogger& errorLogger,
412412
locationList.back().fileIndex = fileIndex;
413413
}
414414

415-
const ErrorMessage errmsg(std::move(locationList), emptyString, Severity::style, "$symbol:" + funcname + "\nThe function '$symbol' is never used.", "unusedFunction", CWE561, Certainty::normal);
415+
const ErrorMessage errmsg(std::move(locationList), "", Severity::style, "$symbol:" + funcname + "\nThe function '$symbol' is never used.", "unusedFunction", CWE561, Certainty::normal);
416416
errorLogger.reportErr(errmsg);
417417
}
418418

lib/cppcheck.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ void CppCheck::internalError(const std::string &filename, const std::string &msg
12981298
ErrorMessage::FileLocation loc1(filename, 0, 0);
12991299

13001300
ErrorMessage errmsg({std::move(loc1)},
1301-
emptyString,
1301+
"",
13021302
Severity::error,
13031303
fullmsg,
13041304
"internalError",
@@ -1333,7 +1333,7 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer, AnalyzerInformation
13331333
if (mSettings.debugwarnings) {
13341334
ErrorMessage::FileLocation loc(tokenizer.list.getFiles()[0], 0, 0);
13351335
ErrorMessage errmsg({std::move(loc)},
1336-
emptyString,
1336+
"",
13371337
Severity::debug,
13381338
"Checks maximum time exceeded",
13391339
"checksMaxTime",
@@ -1843,7 +1843,7 @@ void CppCheck::tooManyConfigsError(const std::string &file, const int numberOfCo
18431843

18441844

18451845
ErrorMessage errmsg(std::move(loclist),
1846-
emptyString,
1846+
"",
18471847
Severity::information,
18481848
msg.str(),
18491849
"toomanyconfigs", CWE398,
@@ -1865,7 +1865,7 @@ void CppCheck::purgedConfigurationMessage(const std::string &file, const std::st
18651865
}
18661866

18671867
ErrorMessage errmsg(std::move(loclist),
1868-
emptyString,
1868+
"",
18691869
Severity::information,
18701870
"The configuration '" + configuration + "' was not checked because its code equals another one.",
18711871
"purgedConfiguration",

lib/preprocessor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ std::list<Directive> Preprocessor::createDirectives(const simplecpp::TokenList &
340340
continue;
341341
if (tok->next && tok->next->str() == "endfile")
342342
continue;
343-
Directive directive(tok->location, emptyString);
343+
Directive directive(tok->location, "");
344344
for (const simplecpp::Token *tok2 = tok; tok2 && tok2->location.line == directive.linenr; tok2 = tok2->next) {
345345
if (tok2->comment)
346346
continue;

lib/suppressions.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ bool SuppressionList::reportUnmatchedSuppressions(const std::list<SuppressionLis
592592
std::list<::ErrorMessage::FileLocation> callStack;
593593
if (!s.fileName.empty())
594594
callStack.emplace_back(s.fileName, s.lineNumber, 0);
595-
errorLogger.reportErr(::ErrorMessage(std::move(callStack), emptyString, Severity::information, "Unmatched suppression: " + s.errorId, "unmatchedSuppression", Certainty::normal));
595+
errorLogger.reportErr(::ErrorMessage(std::move(callStack), "", Severity::information, "Unmatched suppression: " + s.errorId, "unmatchedSuppression", Certainty::normal));
596596
err = true;
597597
}
598598
return err;

lib/templatesimplifier.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -3175,7 +3175,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
31753175
if (mSettings.debugwarnings) {
31763176
ErrorMessage::FileLocation loc(mTokenList.getFiles()[0], 0, 0);
31773177
ErrorMessage errmsg({std::move(loc)},
3178-
emptyString,
3178+
"",
31793179
Severity::debug,
31803180
"Template instantiation maximum time exceeded",
31813181
"templateMaxTime",
@@ -3251,7 +3251,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
32513251
if (mSettings.debugwarnings) {
32523252
ErrorMessage::FileLocation loc(mTokenList.getFiles()[0], 0, 0);
32533253
ErrorMessage errmsg({std::move(loc)},
3254-
emptyString,
3254+
"",
32553255
Severity::debug,
32563256
"Template instantiation maximum time exceeded",
32573257
"templateMaxTime",

lib/tokenize.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ void Tokenizer::simplifyTypedefCpp()
12251225
if (mSettings.debugwarnings) {
12261226
ErrorMessage::FileLocation loc(list.getFiles()[0], 0, 0);
12271227
ErrorMessage errmsg({std::move(loc)},
1228-
emptyString,
1228+
"",
12291229
Severity::debug,
12301230
"Typedef simplification instantiation maximum time exceeded",
12311231
"typedefMaxTime",

lib/valueflow.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -7098,7 +7098,7 @@ struct ValueFlowPassRunner {
70987098
if (n == 0 && values != getTotalValues()) {
70997099
ErrorMessage::FileLocation loc(state.tokenlist.getFiles()[0], 0, 0);
71007100
ErrorMessage errmsg({std::move(loc)},
7101-
emptyString,
7101+
"",
71027102
Severity::debug,
71037103
"ValueFlow maximum iterations exceeded",
71047104
"valueFlowMaxIterations",

0 commit comments

Comments
 (0)