diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 33599b53542..632d86db0ac 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -697,7 +697,7 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string return mExitCode; } - Preprocessor preprocessor(mSettings, this); + Preprocessor preprocessor(mSettings, *this); if (!preprocessor.loadFiles(tokens1, files)) return mExitCode; @@ -1694,7 +1694,7 @@ void CppCheck::getErrorMessages(ErrorLogger &errorlogger) (*it)->getErrorMessages(&errorlogger, &s); CheckUnusedFunctions::getErrorMessages(errorlogger); - Preprocessor::getErrorMessages(&errorlogger, s); + Preprocessor::getErrorMessages(errorlogger, s); } void CppCheck::analyseClangTidy(const FileSettings &fileSettings) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index ba5213470aa..a6557cfc200 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -64,7 +64,7 @@ Directive::Directive(std::string _file, const int _linenr, const std::string &_s char Preprocessor::macroChar = char(1); -Preprocessor::Preprocessor(const Settings& settings, ErrorLogger *errorLogger) : mSettings(settings), mErrorLogger(errorLogger) +Preprocessor::Preprocessor(const Settings& settings, ErrorLogger &errorLogger) : mSettings(settings), mErrorLogger(errorLogger) {} Preprocessor::~Preprocessor() @@ -875,18 +875,18 @@ void Preprocessor::error(const std::string &filename, unsigned int linenr, const locationList.emplace_back(file, linenr, 0); } - mErrorLogger->reportErr(ErrorMessage(std::move(locationList), - mFile0, - Severity::error, - msg, - "preprocessorErrorDirective", - Certainty::normal)); + mErrorLogger.reportErr(ErrorMessage(std::move(locationList), + mFile0, + Severity::error, + msg, + "preprocessorErrorDirective", + Certainty::normal)); } // Report that include is missing void Preprocessor::missingInclude(const std::string &filename, unsigned int linenr, const std::string &header, HeaderTypes headerType) { - if (!mSettings.checks.isEnabled(Checks::missingInclude) || !mErrorLogger) + if (!mSettings.checks.isEnabled(Checks::missingInclude)) return; std::list locationList; @@ -899,10 +899,10 @@ void Preprocessor::missingInclude(const std::string &filename, unsigned int line "Include file: \"" + header + "\" not found.", (headerType==SystemHeader) ? "missingIncludeSystem" : "missingInclude", Certainty::normal); - mErrorLogger->reportErr(errmsg); + mErrorLogger.reportErr(errmsg); } -void Preprocessor::getErrorMessages(ErrorLogger *errorLogger, const Settings &settings) +void Preprocessor::getErrorMessages(ErrorLogger &errorLogger, const Settings &settings) { Preprocessor preprocessor(settings, errorLogger); preprocessor.missingInclude(emptyString, 1, emptyString, UserHeader); diff --git a/lib/preprocessor.h b/lib/preprocessor.h index 267c9ca84e4..01670e83e76 100644 --- a/lib/preprocessor.h +++ b/lib/preprocessor.h @@ -87,7 +87,7 @@ class CPPCHECKLIB WARN_UNUSED Preprocessor { /** character that is inserted in expanded macros */ static char macroChar; - explicit Preprocessor(const Settings& settings, ErrorLogger *errorLogger); + explicit Preprocessor(const Settings& settings, ErrorLogger &errorLogger); virtual ~Preprocessor(); void inlineSuppressions(const simplecpp::TokenList &tokens, SuppressionList &suppressions); @@ -119,7 +119,7 @@ class CPPCHECKLIB WARN_UNUSED Preprocessor { void simplifyPragmaAsm(simplecpp::TokenList *tokenList) const; - static void getErrorMessages(ErrorLogger *errorLogger, const Settings &settings); + static void getErrorMessages(ErrorLogger &errorLogger, const Settings &settings); /** * dump all directives present in source file @@ -139,7 +139,7 @@ class CPPCHECKLIB WARN_UNUSED Preprocessor { static bool hasErrors(const simplecpp::OutputList &outputList); const Settings& mSettings; - ErrorLogger *mErrorLogger; + ErrorLogger &mErrorLogger; /** list of all directives met while preprocessing file */ diff --git a/test/helpers.cpp b/test/helpers.cpp index 0640bf14c50..ba57a0d18ba 100644 --- a/test/helpers.cpp +++ b/test/helpers.cpp @@ -144,12 +144,12 @@ std::string PreprocessorHelper::getcode(Preprocessor &preprocessor, const std::s return ret; } -void PreprocessorHelper::preprocess(const char code[], std::vector &files, Tokenizer& tokenizer) +void PreprocessorHelper::preprocess(const char code[], std::vector &files, Tokenizer& tokenizer, ErrorLogger& errorlogger) { - preprocess(code, files, tokenizer, simplecpp::DUI()); + preprocess(code, files, tokenizer, errorlogger, simplecpp::DUI()); } -void PreprocessorHelper::preprocess(const char code[], std::vector &files, Tokenizer& tokenizer, const simplecpp::DUI& dui) +void PreprocessorHelper::preprocess(const char code[], std::vector &files, Tokenizer& tokenizer, ErrorLogger& errorlogger, const simplecpp::DUI& dui) { std::istringstream istr(code); const simplecpp::TokenList tokens1(istr, files, files[0]); @@ -162,7 +162,7 @@ void PreprocessorHelper::preprocess(const char code[], std::vector // Tokenizer.. tokenizer.list.createTokens(std::move(tokens2)); - const Preprocessor preprocessor(tokenizer.getSettings(), nullptr); + const Preprocessor preprocessor(tokenizer.getSettings(), errorlogger); std::list directives = preprocessor.createDirectives(tokens1); tokenizer.setDirectives(std::move(directives)); } diff --git a/test/helpers.h b/test/helpers.h index fbc8b755ec1..15eeebf4a65 100644 --- a/test/helpers.h +++ b/test/helpers.h @@ -150,8 +150,8 @@ class PreprocessorHelper */ static std::string getcode(Preprocessor &preprocessor, const std::string &filedata, const std::string &cfg, const std::string &filename, SuppressionList *inlineSuppression = nullptr); - static void preprocess(const char code[], std::vector &files, Tokenizer& tokenizer); - static void preprocess(const char code[], std::vector &files, Tokenizer& tokenizer, const simplecpp::DUI& dui); + static void preprocess(const char code[], std::vector &files, Tokenizer& tokenizer, ErrorLogger& errorlogger); + static void preprocess(const char code[], std::vector &files, Tokenizer& tokenizer, ErrorLogger& errorlogger, const simplecpp::DUI& dui); }; namespace cppcheck { diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 5a7a6e98177..f16bc2ac167 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -67,7 +67,7 @@ class TestBufferOverrun : public TestFixture { std::vector files(1, filename); Tokenizer tokenizer(settings, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); // Tokenizer.. ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/testclass.cpp b/test/testclass.cpp index 6e2b42bfb33..6c90e12407a 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -8505,7 +8505,7 @@ class TestClass : public TestFixture { std::vector files(1, "test.cpp"); Tokenizer tokenizer(settings, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); @@ -8912,7 +8912,7 @@ class TestClass : public TestFixture { std::vector files(1, "test.cpp"); Tokenizer tokenizer(settings, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 402a1fc8b86..d14238065f0 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -128,7 +128,7 @@ class TestCondition : public TestFixture { void check_(const char* file, int line, const char code[], const Settings &settings, const char* filename = "test.cpp") { std::vector files(1, filename); Tokenizer tokenizer(settings, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); // Tokenizer.. ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/testincompletestatement.cpp b/test/testincompletestatement.cpp index f30e024e113..87b0ec84875 100644 --- a/test/testincompletestatement.cpp +++ b/test/testincompletestatement.cpp @@ -40,7 +40,7 @@ class TestIncompleteStatement : public TestFixture { std::vector files(1, "test.cpp"); Tokenizer tokenizer(settings1, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); // Tokenize.. ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/testleakautovar.cpp b/test/testleakautovar.cpp index 1c788ece2b9..ed47ce67ce0 100644 --- a/test/testleakautovar.cpp +++ b/test/testleakautovar.cpp @@ -3072,7 +3072,7 @@ class TestLeakAutoVarRecursiveCountLimit : public TestFixture { void checkP_(const char* file, int line, const char code[], bool cpp = false) { std::vector files(1, cpp?"test.cpp":"test.c"); Tokenizer tokenizer(settings, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); // Tokenizer.. ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index b950af68275..77a6438ef65 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -193,7 +193,7 @@ class TestNullPointer : public TestFixture { std::vector files(1, "test.cpp"); Tokenizer tokenizer(settings1, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); // Tokenizer.. ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/testother.cpp b/test/testother.cpp index c5d2c50591f..113de252214 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -332,7 +332,7 @@ class TestOther : public TestFixture { std::vector files(1, filename); Tokenizer tokenizer(*settings, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); // Tokenizer.. ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index a631ca5dfa5..8ddd013ca90 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -59,7 +59,7 @@ class TestPreprocessor : public TestFixture { if (errorLogger) { const Settings settings; - Preprocessor p(settings, errorLogger); + Preprocessor p(settings, *errorLogger); p.reportOutput(outputList, true); } @@ -69,7 +69,7 @@ class TestPreprocessor : public TestFixture { private: const Settings settings0 = settingsBuilder().severity(Severity::information).build(); - Preprocessor preprocessor0{settings0, this}; + Preprocessor preprocessor0{settings0, *this}; void run() override { @@ -298,7 +298,7 @@ class TestPreprocessor : public TestFixture { settings.userDefines = arg + 2; if (arg && std::strncmp(arg,"-U",2)==0) settings.userUndefs.insert(arg+2); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); std::vector files; std::istringstream istr(filedata); simplecpp::TokenList tokens(istr,files); @@ -362,7 +362,7 @@ class TestPreprocessor : public TestFixture { void error3() { const auto settings = dinit(Settings, $.userDefines = "__cplusplus"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); const std::string code("#error hello world!\n"); PreprocessorHelper::getcode(preprocessor, code, "X", "test.c"); ASSERT_EQUALS("[test.c:1]: (error) #error hello world!\n", errout_str()); @@ -373,7 +373,7 @@ class TestPreprocessor : public TestFixture { // In included file { const auto settings = dinit(Settings, $.userDefines = "TEST"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); const std::string code("#file \"ab.h\"\n#error hello world!\n#endfile"); PreprocessorHelper::getcode(preprocessor, code, "TEST", "test.c"); ASSERT_EQUALS("[ab.h:1]: (error) #error hello world!\n", errout_str()); @@ -382,7 +382,7 @@ class TestPreprocessor : public TestFixture { // After including a file { const auto settings = dinit(Settings, $.userDefines = "TEST"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); const std::string code("#file \"ab.h\"\n\n#endfile\n#error aaa"); PreprocessorHelper::getcode(preprocessor, code, "TEST", "test.c"); ASSERT_EQUALS("[test.c:2]: (error) #error aaa\n", errout_str()); @@ -394,7 +394,7 @@ class TestPreprocessor : public TestFixture { const auto settings = dinit(Settings, $.userDefines = "TEST", $.force = true); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); const std::string code("#error hello world!\n"); PreprocessorHelper::getcode(preprocessor, code, "X", "test.c"); ASSERT_EQUALS("", errout_str()); @@ -471,7 +471,7 @@ class TestPreprocessor : public TestFixture { // preprocess code with unix32 platform.. { const Settings settings = settingsBuilder().platform(Platform::Type::Unix32).build(); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); preprocessor.setPlatformInfo(&tokens); ASSERT_EQUALS("\n1", preprocessor.getcode(tokens, "", files, false)); } @@ -479,7 +479,7 @@ class TestPreprocessor : public TestFixture { // preprocess code with unix64 platform.. { const Settings settings = settingsBuilder().platform(Platform::Type::Unix64).build(); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); preprocessor.setPlatformInfo(&tokens); ASSERT_EQUALS("\n\n\n2", preprocessor.getcode(tokens, "", files, false)); } @@ -1944,7 +1944,7 @@ class TestPreprocessor : public TestFixture { /*const*/ Settings settings; settings.inlineSuppressions = true; settings.checks.enable(Checks::missingInclude); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); const std::string code("// cppcheck-suppress missingInclude\n" "#include \"missing.h\"\n" @@ -2302,7 +2302,7 @@ class TestPreprocessor : public TestFixture { void wrongPathOnErrorDirective() { const auto settings = dinit(Settings, $.userDefines = "foo"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); const std::string code("#error hello world!\n"); PreprocessorHelper::getcode(preprocessor, code, "X", "./././test.c"); ASSERT_EQUALS("[test.c:1]: (error) #error hello world!\n", errout_str()); @@ -2315,7 +2315,7 @@ class TestPreprocessor : public TestFixture { settings.checks.enable(Checks::missingInclude); settings.templateFormat = "simple"; // has no effect setTemplateFormat("simple"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); ScopedFile header("header.h", ""); @@ -2332,7 +2332,7 @@ class TestPreprocessor : public TestFixture { settings.checks.enable(Checks::missingInclude); settings.templateFormat = "simple"; // has no effect setTemplateFormat("simple"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); std::string code("#include \"header.h\""); PreprocessorHelper::getcode(preprocessor, code, "", "test.c"); @@ -2347,7 +2347,7 @@ class TestPreprocessor : public TestFixture { settings.checks.enable(Checks::missingInclude); settings.templateFormat = "simple"; // has no effect setTemplateFormat("simple"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); ScopedFile header("header.h", "", "inc"); @@ -2365,7 +2365,7 @@ class TestPreprocessor : public TestFixture { settings.includePaths.emplace_back("inc"); settings.templateFormat = "simple"; // has no effect setTemplateFormat("simple"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); ScopedFile header("header.h", "", "inc"); @@ -2383,7 +2383,7 @@ class TestPreprocessor : public TestFixture { settings.includePaths.emplace_back("inc"); settings.templateFormat = "simple"; // has no effect setTemplateFormat("simple"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); ScopedFile header("header.h", "", Path::getCurrentPath()); @@ -2400,7 +2400,7 @@ class TestPreprocessor : public TestFixture { settings.checks.enable(Checks::missingInclude); settings.templateFormat = "simple"; // has no effect setTemplateFormat("simple"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); const std::string header = Path::join(Path::getCurrentPath(), "header.h"); @@ -2417,7 +2417,7 @@ class TestPreprocessor : public TestFixture { settings.checks.enable(Checks::missingInclude); settings.templateFormat = "simple"; // has no effect setTemplateFormat("simple"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); ScopedFile header("header.h", ""); @@ -2434,7 +2434,7 @@ class TestPreprocessor : public TestFixture { settings.checks.enable(Checks::missingInclude); settings.templateFormat = "simple"; // has no effect setTemplateFormat("simple"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); std::string code("#include "); PreprocessorHelper::getcode(preprocessor, code, "", "test.c"); @@ -2451,7 +2451,7 @@ class TestPreprocessor : public TestFixture { setTemplateFormat("simple"); settings.includePaths.emplace_back("system"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); ScopedFile header("header.h", "", "system"); @@ -2469,7 +2469,7 @@ class TestPreprocessor : public TestFixture { settings.includePaths.emplace_back("inc"); settings.templateFormat = "simple"; // has no effect setTemplateFormat("simple"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); ScopedFile header("header.h", "", Path::getCurrentPath()); @@ -2486,7 +2486,7 @@ class TestPreprocessor : public TestFixture { settings.checks.enable(Checks::missingInclude); settings.templateFormat = "simple"; // has no effect setTemplateFormat("simple"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); const std::string header = Path::join(Path::getCurrentPath(), "header.h"); @@ -2503,7 +2503,7 @@ class TestPreprocessor : public TestFixture { settings.checks.enable(Checks::missingInclude); settings.templateFormat = "simple"; // has no effect setTemplateFormat("simple"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); ScopedFile header("header.h", ""); ScopedFile header2("header2.h", ""); @@ -2527,7 +2527,7 @@ class TestPreprocessor : public TestFixture { settings.templateFormat = "simple"; // has no effect setTemplateFormat("simple"); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); ScopedFile header("header.h", ""); ScopedFile header2("header2.h", ""); diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index ddb1fbb4718..310d67b5858 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -262,7 +262,7 @@ class TestSimplifyTypedef : public TestFixture { std::string simplifyTypedefP(const char code[]) { std::vector files(1, "test.cpp"); Tokenizer tokenizer(settings0, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); // Tokenize.. tokenizer.createLinks(); diff --git a/test/testsimplifyusing.cpp b/test/testsimplifyusing.cpp index dd89c87eef9..fde48a0a9d6 100644 --- a/test/testsimplifyusing.cpp +++ b/test/testsimplifyusing.cpp @@ -100,7 +100,7 @@ class TestSimplifyUsing : public TestFixture { if (preprocess) { Tokenizer tokenizer(settings, this); std::vector files(1, "test.cpp"); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); std::istringstream istr(code); ASSERT_LOC(tokenizer.list.createTokens(istr, "test.cpp"), file, line); // TODO: this creates the tokens a second time ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/testsizeof.cpp b/test/testsizeof.cpp index 9a576629c50..9822adae4c3 100644 --- a/test/testsizeof.cpp +++ b/test/testsizeof.cpp @@ -61,7 +61,7 @@ class TestSizeof : public TestFixture { void checkP_(const char* file, int line, const char code[]) { std::vector files(1, "test.cpp"); Tokenizer tokenizer(settings, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); // Tokenize.. ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/teststring.cpp b/test/teststring.cpp index 2ec35394bbb..ca579783389 100644 --- a/test/teststring.cpp +++ b/test/teststring.cpp @@ -66,7 +66,7 @@ class TestString : public TestFixture { void check_(const char* file, int line, const char code[], const char filename[] = "test.cpp") { std::vector files(1, filename); Tokenizer tokenizer(settings, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); // Tokenize.. ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 877e43847c5..5536e40698f 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -502,7 +502,7 @@ class TestTokenizer : public TestFixture { } void directiveDump(const char filedata[], std::ostream& ostr) { - Preprocessor preprocessor(settingsDefault, this); + Preprocessor preprocessor(settingsDefault, *this); std::istringstream istr(filedata); simplecpp::OutputList outputList; std::vector files; @@ -6866,7 +6866,7 @@ class TestTokenizer : public TestFixture { "int PTR4 q4_var RBR4 = 0;\n"; // Preprocess file.. - Preprocessor preprocessor(settings0, this); + Preprocessor preprocessor(settings0, *this); std::istringstream fin(raw_code); simplecpp::OutputList outputList; std::vector files; @@ -7702,7 +7702,7 @@ class TestTokenizer : public TestFixture { std::vector files(1, "test.cpp"); Tokenizer tokenizer(settings, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); // Tokenizer.. ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/testtype.cpp b/test/testtype.cpp index 34ba2f55268..1a4a3261acf 100644 --- a/test/testtype.cpp +++ b/test/testtype.cpp @@ -66,7 +66,7 @@ class TestType : public TestFixture { std::vector files(1, filename); Tokenizer tokenizer(settings1, this); - PreprocessorHelper::preprocess(code, files, tokenizer, dui); + PreprocessorHelper::preprocess(code, files, tokenizer, *this, dui); // Tokenizer.. ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/testunusedfunctions.cpp b/test/testunusedfunctions.cpp index d5a48bb5c8a..9ad7d655b5d 100644 --- a/test/testunusedfunctions.cpp +++ b/test/testunusedfunctions.cpp @@ -682,7 +682,7 @@ class TestUnusedFunctions : public TestFixture { "};"; const char code[] = R"(#include "test.h")"; ScopedFile header("test.h", inc); - Preprocessor preprocessor(settings, this); + Preprocessor preprocessor(settings, *this); const std::string processed = PreprocessorHelper::getcode(preprocessor, code, "", "test.cpp"); check(processed.c_str()); TODO_ASSERT_EQUALS("[test.h:3]: (style) The function 'f' is never used.\n", "[test.cpp:3]: (style) The function 'f' is never used.\n", errout_str()); diff --git a/test/testunusedprivfunc.cpp b/test/testunusedprivfunc.cpp index 41acd9525aa..a9a5357ed25 100644 --- a/test/testunusedprivfunc.cpp +++ b/test/testunusedprivfunc.cpp @@ -92,7 +92,7 @@ class TestUnusedPrivateFunction : public TestFixture { std::vector files(1, "test.cpp"); Tokenizer tokenizer(settings1, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); // Tokenize.. ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/testunusedvar.cpp b/test/testunusedvar.cpp index d390ed628a3..deaf3795b2e 100644 --- a/test/testunusedvar.cpp +++ b/test/testunusedvar.cpp @@ -277,7 +277,7 @@ class TestUnusedVar : public TestFixture { void checkStructMemberUsageP_(const char* file, int line, const char code[]) { std::vector files(1, "test.cpp"); Tokenizer tokenizer(settings, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); // Tokenizer.. ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); @@ -291,7 +291,7 @@ class TestUnusedVar : public TestFixture { void checkFunctionVariableUsageP_(const char* file, int line, const char code[], const char* filename = "test.cpp") { std::vector files(1, filename); Tokenizer tokenizer(settings, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); // Tokenizer.. ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 0b8b4a962d2..d7606db0292 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -477,7 +477,7 @@ class TestValueFlow : public TestFixture { std::vector files(1, "test.cpp"); Tokenizer tokenizer(s, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); // Tokenize.. ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line); diff --git a/test/testvarid.cpp b/test/testvarid.cpp index 635f26d6f6b..831b74cf5e4 100644 --- a/test/testvarid.cpp +++ b/test/testvarid.cpp @@ -280,7 +280,7 @@ class TestVarID : public TestFixture { std::string tokenizeExpr_(const char* file, int line, const char code[], const char filename[] = "test.cpp") { std::vector files(1, filename); Tokenizer tokenizer(settings, this); - PreprocessorHelper::preprocess(code, files, tokenizer); + PreprocessorHelper::preprocess(code, files, tokenizer, *this); ASSERT_LOC(tokenizer.simplifyTokens1(""), file, line);