Skip to content

Commit 169286e

Browse files
committed
pass ErrorLogger by reference into Check::getErrorMessages()
1 parent 8c14fc7 commit 169286e

49 files changed

Lines changed: 81 additions & 81 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/check.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class CPPCHECKLIB Check {
6565
virtual void runChecks(const Tokenizer &, ErrorLogger *) = 0;
6666

6767
/** get error messages */
68-
virtual void getErrorMessages(ErrorLogger *errorLogger, const Settings &settings) const = 0;
68+
virtual void getErrorMessages(ErrorLogger& errorLogger, const Settings &settings) const = 0;
6969

7070
/** class name, used to generate documentation */
7171
const std::string& name() const {

lib/check64bit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ void Check64BitPortability::runChecks(const Tokenizer &tokenizer, ErrorLogger *e
189189
check64BitPortability.pointerassignment();
190190
}
191191

192-
void Check64BitPortability::getErrorMessages(ErrorLogger *errorLogger, const Settings &settings) const
192+
void Check64BitPortability::getErrorMessages(ErrorLogger& errorLogger, const Settings &settings) const
193193
{
194-
Check64BitPortabilityImpl c(nullptr, settings, errorLogger);
194+
Check64BitPortabilityImpl c(nullptr, settings, &errorLogger);
195195
c.assignmentAddressToIntegerError(nullptr);
196196
c.assignmentIntegerToAddressError(nullptr);
197197
c.returnIntegerError(nullptr);

lib/check64bit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class CPPCHECKLIB Check64BitPortability : public Check {
5151
/** @brief Run checks against the normal token list */
5252
void runChecks(const Tokenizer &tokenizer, ErrorLogger *errorLogger) override;
5353

54-
void getErrorMessages(ErrorLogger *errorLogger, const Settings &settings) const override;
54+
void getErrorMessages(ErrorLogger& errorLogger, const Settings &settings) const override;
5555

5656
std::string classInfo() const override {
5757
return "Check if there is 64-bit portability issues:\n"

lib/checkassert.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ void CheckAssert::runChecks(const Tokenizer &tokenizer, ErrorLogger *errorLogger
184184
checkAssert.assertWithSideEffects();
185185
}
186186

187-
void CheckAssert::getErrorMessages(ErrorLogger *errorLogger, const Settings &settings) const
187+
void CheckAssert::getErrorMessages(ErrorLogger& errorLogger, const Settings &settings) const
188188
{
189-
CheckAssertImpl c(nullptr, settings, errorLogger);
189+
CheckAssertImpl c(nullptr, settings, &errorLogger);
190190
c.sideEffectInAssertError(nullptr, "function");
191191
c.assignmentInAssertError(nullptr, "var");
192192
}

lib/checkassert.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class CPPCHECKLIB CheckAssert : public Check {
4848
private:
4949
/** run checks, the token list is not simplified */
5050
void runChecks(const Tokenizer &tokenizer, ErrorLogger *errorLogger) override;
51-
void getErrorMessages(ErrorLogger *errorLogger, const Settings &settings) const override;
51+
void getErrorMessages(ErrorLogger& errorLogger, const Settings &settings) const override;
5252

5353
std::string classInfo() const override {
5454
return "Warn if there are side effects in assert statements (since this cause different behaviour in debug/release builds).\n";

lib/checkautovariables.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,9 +825,9 @@ void CheckAutoVariables::runChecks(const Tokenizer &tokenizer, ErrorLogger *erro
825825
checkAutoVariables.checkVarLifetime();
826826
}
827827

828-
void CheckAutoVariables::getErrorMessages(ErrorLogger *errorLogger, const Settings &settings) const
828+
void CheckAutoVariables::getErrorMessages(ErrorLogger& errorLogger, const Settings &settings) const
829829
{
830-
CheckAutoVariablesImpl c(nullptr,settings,errorLogger);
830+
CheckAutoVariablesImpl c(nullptr,settings,&errorLogger);
831831
c.errorAutoVariableAssignment(nullptr, false);
832832
c.errorReturnReference(nullptr, ErrorPath{}, false);
833833
c.errorDanglingReference(nullptr, nullptr, ErrorPath{});

lib/checkautovariables.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class CPPCHECKLIB CheckAutoVariables : public Check {
5454
/** @brief Run checks against the normal token list */
5555
void runChecks(const Tokenizer &tokenizer, ErrorLogger *errorLogger) override;
5656

57-
void getErrorMessages(ErrorLogger *errorLogger, const Settings &settings) const override;
57+
void getErrorMessages(ErrorLogger& errorLogger, const Settings &settings) const override;
5858

5959
std::string classInfo() const override {
6060
return "A pointer to a variable is only valid as long as the variable is in scope.\n"

lib/checkbool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,9 @@ void CheckBool::runChecks(const Tokenizer &tokenizer, ErrorLogger *errorLogger)
529529
checkBool.checkBitwiseOnBoolean();
530530
}
531531

532-
void CheckBool::getErrorMessages(ErrorLogger *errorLogger, const Settings &settings) const
532+
void CheckBool::getErrorMessages(ErrorLogger& errorLogger, const Settings &settings) const
533533
{
534-
CheckBoolImpl c(nullptr, settings, errorLogger);
534+
CheckBoolImpl c(nullptr, settings, &errorLogger);
535535
c.assignBoolToPointerError(nullptr);
536536
c.assignBoolToFloatError(nullptr);
537537
c.comparisonOfFuncReturningBoolError(nullptr, "func_name");

lib/checkbool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class CPPCHECKLIB CheckBool : public Check {
4848
/** @brief Run checks against the normal token list */
4949
void runChecks(const Tokenizer &tokenizer, ErrorLogger *errorLogger) override;
5050

51-
void getErrorMessages(ErrorLogger *errorLogger, const Settings &settings) const override;
51+
void getErrorMessages(ErrorLogger& errorLogger, const Settings &settings) const override;
5252

5353
std::string classInfo() const override {
5454
return "Boolean type checks\n"

lib/checkbufferoverrun.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,9 +1227,9 @@ void CheckBufferOverrun::runChecks(const Tokenizer &tokenizer, ErrorLogger *erro
12271227
checkBufferOverrun.negativeArraySize();
12281228
}
12291229

1230-
void CheckBufferOverrun::getErrorMessages(ErrorLogger *errorLogger, const Settings &settings) const
1230+
void CheckBufferOverrun::getErrorMessages(ErrorLogger& errorLogger, const Settings &settings) const
12311231
{
1232-
CheckBufferOverrunImpl c(nullptr, settings, errorLogger);
1232+
CheckBufferOverrunImpl c(nullptr, settings, &errorLogger);
12331233
c.arrayIndexError(nullptr, std::vector<Dimension>(), std::vector<ValueFlow::Value>());
12341234
c.pointerArithmeticError(nullptr, nullptr, nullptr);
12351235
c.negativeIndexError(nullptr, std::vector<Dimension>(), std::vector<ValueFlow::Value>());

0 commit comments

Comments
 (0)