Skip to content

Commit fed91ac

Browse files
authored
PreprocessorHelper: avoid potential ambiguity in future cleanups (#7797)
1 parent 411a3a7 commit fed91ac

File tree

5 files changed

+61
-60
lines changed

5 files changed

+61
-60
lines changed

test/helpers.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ ScopedFile::~ScopedFile() {
115115
}
116116

117117
// TODO: we should be using the actual Preprocessor implementation
118-
std::string PreprocessorHelper::getcode(const Settings& settings, ErrorLogger& errorlogger, const std::string &filedata, const std::string &cfg, const std::string &filename, SuppressionList *inlineSuppression)
118+
std::string PreprocessorHelper::getcodeforcfg(const Settings& settings, ErrorLogger& errorlogger, const std::string &filedata, const std::string &cfg, const std::string &filename, SuppressionList *inlineSuppression)
119119
{
120120
std::map<std::string, std::string> cfgcode = getcode(settings, errorlogger, filedata.c_str(), std::set<std::string>{cfg}, filename, inlineSuppression);
121121
const auto it = cfgcode.find(cfg);
@@ -124,9 +124,9 @@ std::string PreprocessorHelper::getcode(const Settings& settings, ErrorLogger& e
124124
return it->second;
125125
}
126126

127-
std::map<std::string, std::string> PreprocessorHelper::getcode(const Settings& settings, ErrorLogger& errorlogger, const char code[], const std::string &filename, SuppressionList *inlineSuppression)
127+
std::map<std::string, std::string> PreprocessorHelper::getcode(const Settings& settings, ErrorLogger& errorlogger, const char code[], const std::string &filename)
128128
{
129-
return getcode(settings, errorlogger, code, {}, filename, inlineSuppression);
129+
return getcode(settings, errorlogger, code, {}, filename, nullptr);
130130
}
131131

132132
std::map<std::string, std::string> PreprocessorHelper::getcode(const Settings& settings, ErrorLogger& errorlogger, const char code[], std::set<std::string> cfgs, const std::string &filename, SuppressionList *inlineSuppression)

test/helpers.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,12 @@ class PreprocessorHelper
172172
* @param filename name of source file
173173
* @param inlineSuppression the inline suppressions
174174
*/
175-
static std::string getcode(const Settings& settings, ErrorLogger& errorlogger, const std::string &filedata, const std::string &cfg, const std::string &filename, SuppressionList *inlineSuppression = nullptr);
176-
static std::map<std::string, std::string> getcode(const Settings& settings, ErrorLogger& errorlogger, const char code[], const std::string &filename = "file.c", SuppressionList *inlineSuppression = nullptr);
175+
static std::string getcodeforcfg(const Settings& settings, ErrorLogger& errorlogger, const std::string &filedata, const std::string &cfg, const std::string &filename, SuppressionList *inlineSuppression = nullptr);
176+
177+
static std::map<std::string, std::string> getcode(const Settings& settings, ErrorLogger& errorlogger, const char code[], const std::string &filename = "file.c");
177178

178179
private:
179-
static std::map<std::string, std::string> getcode(const Settings& settings, ErrorLogger& errorlogger, const char code[], std::set<std::string> cfgs, const std::string &filename = "file.c", SuppressionList *inlineSuppression = nullptr);
180+
static std::map<std::string, std::string> getcode(const Settings& settings, ErrorLogger& errorlogger, const char code[], std::set<std::string> cfgs, const std::string &filename, SuppressionList *inlineSuppression);
180181
};
181182

182183
namespace cppcheck {

0 commit comments

Comments
 (0)