Refactoring: Removed redundant settings parameter for Preprocessor::removeComments
This commit is contained in:
parent
94d220e370
commit
e4875178fa
|
@ -164,7 +164,7 @@ std::string Preprocessor::read(std::istream &istr, const std::string &filename)
|
|||
// ------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Remove all comments..
|
||||
result = removeComments(result, filename, _settings);
|
||||
result = removeComments(result, filename);
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -301,7 +301,7 @@ static bool isFallThroughComment(std::string comment)
|
|||
comment == "fall";
|
||||
}
|
||||
|
||||
std::string Preprocessor::removeComments(const std::string &str, const std::string &filename, Settings *settings)
|
||||
std::string Preprocessor::removeComments(const std::string &str, const std::string &filename)
|
||||
{
|
||||
// For the error report
|
||||
unsigned int lineno = 1;
|
||||
|
@ -371,7 +371,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
|
|||
break;
|
||||
std::string comment(str, commentStart, i - commentStart);
|
||||
|
||||
if (settings && settings->_inlineSuppressions) {
|
||||
if (_settings && _settings->_inlineSuppressions) {
|
||||
std::istringstream iss(comment);
|
||||
std::string word;
|
||||
iss >> word;
|
||||
|
@ -408,7 +408,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
|
|||
fallThroughComment = true;
|
||||
}
|
||||
|
||||
if (settings && settings->_inlineSuppressions) {
|
||||
if (_settings && _settings->_inlineSuppressions) {
|
||||
std::istringstream iss(comment);
|
||||
std::string word;
|
||||
iss >> word;
|
||||
|
@ -425,10 +425,10 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
|
|||
|
||||
// Add any pending inline suppressions that have accumulated.
|
||||
if (!suppressionIDs.empty()) {
|
||||
if (settings != NULL) {
|
||||
if (_settings != NULL) {
|
||||
// Add the suppressions.
|
||||
for (size_t j(0); j < suppressionIDs.size(); ++j) {
|
||||
const std::string errmsg(settings->nomsg.addSuppression(suppressionIDs[j], filename, lineno));
|
||||
const std::string errmsg(_settings->nomsg.addSuppression(suppressionIDs[j], filename, lineno));
|
||||
if (!errmsg.empty()) {
|
||||
writeError(filename, lineno, _errorLogger, "cppcheckError", errmsg);
|
||||
}
|
||||
|
@ -453,10 +453,10 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
|
|||
|
||||
// Add any pending inline suppressions that have accumulated.
|
||||
if (!suppressionIDs.empty()) {
|
||||
if (settings != NULL) {
|
||||
if (_settings != NULL) {
|
||||
// Add the suppressions.
|
||||
for (size_t j(0); j < suppressionIDs.size(); ++j) {
|
||||
const std::string errmsg(settings->nomsg.addSuppression(suppressionIDs[j], filename, lineno));
|
||||
const std::string errmsg(_settings->nomsg.addSuppression(suppressionIDs[j], filename, lineno));
|
||||
if (!errmsg.empty()) {
|
||||
writeError(filename, lineno, _errorLogger, "cppcheckError", errmsg);
|
||||
}
|
||||
|
|
|
@ -137,12 +137,12 @@ protected:
|
|||
|
||||
/**
|
||||
* Remove comments from code. This should only be called from read().
|
||||
* If there are inline suppressions, the _settings member is modified
|
||||
* @param str Code processed by read().
|
||||
* @param filename filename
|
||||
* @param settings Settings. If there are inline suppressions these will be added to the settings
|
||||
* @return code without comments
|
||||
*/
|
||||
std::string removeComments(const std::string &str, const std::string &filename, Settings *settings);
|
||||
std::string removeComments(const std::string &str, const std::string &filename);
|
||||
|
||||
/**
|
||||
* Cleanup 'if 0' from the code
|
||||
|
|
Loading…
Reference in New Issue