Refactoring: Made Preprocessor::simplifyCondition nonstatic
This commit is contained in:
parent
66472b09c0
commit
bd8c21fc6b
|
@ -1221,8 +1221,8 @@ std::list<std::string> Preprocessor::getcfgs(const std::string &filedata, const
|
|||
|
||||
void Preprocessor::simplifyCondition(const std::map<std::string, std::string> &cfg, std::string &condition, bool match)
|
||||
{
|
||||
Settings settings;
|
||||
Tokenizer tokenizer(&settings, NULL);
|
||||
const Settings settings;
|
||||
Tokenizer tokenizer(&settings, _errorLogger);
|
||||
std::istringstream istr("(" + condition + ")");
|
||||
if (!tokenizer.tokenize(istr, "", "", true)) {
|
||||
// If tokenize returns false, then there is syntax error in the
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
* @param condition The condition to simplify
|
||||
* @param match if true, 'defined(A)' is replaced with 0 if A is not defined
|
||||
*/
|
||||
static void simplifyCondition(const std::map<std::string, std::string> &variables, std::string &condition, bool match);
|
||||
void simplifyCondition(const std::map<std::string, std::string> &variables, std::string &condition, bool match);
|
||||
|
||||
/**
|
||||
* preprocess all whitespaces
|
||||
|
|
|
@ -2858,7 +2858,8 @@ private:
|
|||
std::map<std::string, std::string> cfg;
|
||||
cfg["C"] = "";
|
||||
std::string condition("defined(A) || defined(B) || defined(C)");
|
||||
Preprocessor::simplifyCondition(cfg, condition, true);
|
||||
Preprocessor preprocessor(NULL, this);
|
||||
preprocessor.simplifyCondition(cfg, condition, true);
|
||||
ASSERT_EQUALS("1", condition);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue