Skip to content

Commit d307417

Browse files
committed
small check*.h cleanups
1 parent 731513e commit d307417

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

Diff for: lib/checkautovariables.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,12 @@ class CPPCHECKLIB CheckAutoVariables : public Check {
9191
void errorUselessAssignmentPtrArg(const Token *tok);
9292

9393
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
94-
ErrorPath errorPath;
9594
CheckAutoVariables c(nullptr,settings,errorLogger);
9695
c.errorAutoVariableAssignment(nullptr, false);
97-
c.errorReturnReference(nullptr, errorPath, false);
98-
c.errorDanglingReference(nullptr, nullptr, errorPath);
99-
c.errorReturnTempReference(nullptr, errorPath, false);
100-
c.errorDanglingTempReference(nullptr, std::move(errorPath), false);
96+
c.errorReturnReference(nullptr, ErrorPath{}, false);
97+
c.errorDanglingReference(nullptr, nullptr, ErrorPath{});
98+
c.errorReturnTempReference(nullptr, ErrorPath{}, false);
99+
c.errorDanglingTempReference(nullptr, ErrorPath{}, false);
101100
c.errorInvalidDeallocation(nullptr, nullptr);
102101
c.errorUselessAssignmentArg(nullptr);
103102
c.errorUselessAssignmentPtrArg(nullptr);

Diff for: lib/checkother.h

+4-6
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,6 @@ class CPPCHECKLIB CheckOther : public Check {
293293
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
294294
CheckOther c(nullptr, settings, errorLogger);
295295

296-
ErrorPath errorPath;
297-
298296
// error
299297
c.zerodivError(nullptr, nullptr);
300298
c.misusedScopeObjectError(nullptr, "varname");
@@ -326,12 +324,12 @@ class CPPCHECKLIB CheckOther : public Check {
326324
c.selfAssignmentError(nullptr, "varname");
327325
c.clarifyCalculationError(nullptr, "+");
328326
c.clarifyStatementError(nullptr);
329-
c.duplicateBranchError(nullptr, nullptr, errorPath);
327+
c.duplicateBranchError(nullptr, nullptr, ErrorPath{});
330328
c.duplicateAssignExpressionError(nullptr, nullptr, true);
331-
c.oppositeExpressionError(nullptr, errorPath);
332-
c.duplicateExpressionError(nullptr, nullptr, nullptr, errorPath);
329+
c.oppositeExpressionError(nullptr, ErrorPath{});
330+
c.duplicateExpressionError(nullptr, nullptr, nullptr, ErrorPath{});
333331
c.duplicateValueTernaryError(nullptr);
334-
c.duplicateExpressionTernaryError(nullptr, std::move(errorPath));
332+
c.duplicateExpressionTernaryError(nullptr, ErrorPath{});
335333
c.duplicateBreakError(nullptr, false);
336334
c.unreachableCodeError(nullptr, nullptr, false);
337335
c.unsignedLessThanZeroError(nullptr, nullptr, "varname");

Diff for: lib/checkstl.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,14 @@ class CPPCHECKLIB CheckStl : public Check {
243243
void localMutexError(const Token *tok);
244244

245245
void getErrorMessages(ErrorLogger* errorLogger, const Settings* settings) const override {
246-
ErrorPath errorPath;
247246
CheckStl c(nullptr, settings, errorLogger);
248247
c.outOfBoundsError(nullptr, "container", nullptr, "x", nullptr);
249248
c.invalidIteratorError(nullptr, "iterator");
250249
c.iteratorsError(nullptr, "container1", "container2");
251250
c.iteratorsError(nullptr, nullptr, "container0", "container1");
252251
c.iteratorsError(nullptr, nullptr, "container");
253-
c.invalidContainerLoopError(nullptr, nullptr, errorPath);
254-
c.invalidContainerError(nullptr, nullptr, nullptr, std::move(errorPath));
252+
c.invalidContainerLoopError(nullptr, nullptr, ErrorPath{});
253+
c.invalidContainerError(nullptr, nullptr, nullptr, ErrorPath{});
255254
c.mismatchingContainerIteratorError(nullptr, nullptr, nullptr);
256255
c.mismatchingContainersError(nullptr, nullptr);
257256
c.mismatchingContainerExpressionError(nullptr, nullptr);

Diff for: lib/checkuninitvar.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ class CPPCHECKLIB CheckUninitVar : public Check {
117117
void uninitdataError(const Token *tok, const std::string &varname);
118118
void uninitvarError(const Token *tok, const std::string &varname, ErrorPath errorPath);
119119
void uninitvarError(const Token *tok, const std::string &varname) {
120-
ErrorPath errorPath;
121-
uninitvarError(tok, varname, std::move(errorPath));
120+
uninitvarError(tok, varname, ErrorPath{});
122121
}
123122
void uninitvarError(const Token *tok, const std::string &varname, Alloc alloc) {
124123
if (alloc == NO_CTOR_CALL || alloc == CTOR_CALL)

0 commit comments

Comments
 (0)