Preprocessor: Fix so the unit tests work again

This commit is contained in:
Daniel Marjamäki 2009-12-06 19:53:17 +01:00
parent bbc63b6b5b
commit 046db9b2bb
3 changed files with 9 additions and 3 deletions

View File

@ -201,7 +201,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
if (i == std::string::npos)
break;
if (settings->_inlineSuppressions)
if (settings && settings->_inlineSuppressions)
{
std::string comment(str, commentStart, i - commentStart);
std::istringstream iss(comment);

View File

@ -72,6 +72,12 @@ public:
/** Just read the code into a string. Perform simple cleanup of the code */
static std::string read(std::istream &istr, const std::string &filename, Settings *settings);
/** Just read the code into a string. Perform simple cleanup of the code */
static std::string read(std::istream &istr)
{
return read(istr, "", 0);
}
/**
* Get preprocessed code for a given configuration
*/

View File

@ -793,7 +793,7 @@ private:
// Preprocess => actual result..
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
const Settings settings;
Settings settings;
Preprocessor preprocessor(&settings, this);
preprocessor.preprocess(istr, actual, "file.c");
@ -811,7 +811,7 @@ private:
// Preprocess => actual result..
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
const Settings settings;
Settings settings;
Preprocessor preprocessor(&settings, this);
preprocessor.preprocess(istr, actual, "file.c");