Commit cfc2cf95 authored by Ben Boeckel's avatar Ben Boeckel Committed by Brad King
Browse files

cmGeneratorExpression: Tokenize over strings

parent f0ad6631
......@@ -33,17 +33,17 @@ cmGeneratorExpression::cmGeneratorExpression(
cmsys::auto_ptr<cmCompiledGeneratorExpression>
cmGeneratorExpression::Parse(std::string const& input)
{
return this->Parse(input.c_str());
return cmsys::auto_ptr<cmCompiledGeneratorExpression>(
new cmCompiledGeneratorExpression(
this->Backtrace,
input));
}
//----------------------------------------------------------------------------
cmsys::auto_ptr<cmCompiledGeneratorExpression>
cmGeneratorExpression::Parse(const char* input)
{
return cmsys::auto_ptr<cmCompiledGeneratorExpression>(
new cmCompiledGeneratorExpression(
this->Backtrace,
input));
return this->Parse(std::string(input ? input : ""));
}
cmGeneratorExpression::~cmGeneratorExpression()
......@@ -122,13 +122,13 @@ const char *cmCompiledGeneratorExpression::Evaluate(
cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
cmListFileBacktrace const& backtrace,
const char *input)
: Backtrace(backtrace), Input(input ? input : ""),
const std::string& input)
: Backtrace(backtrace), Input(input),
HadContextSensitiveCondition(false)
{
cmGeneratorExpressionLexer l;
std::vector<cmGeneratorExpressionToken> tokens =
l.Tokenize(this->Input.c_str());
l.Tokenize(this->Input);
this->NeedsEvaluation = l.GetSawGeneratorExpression();
if (this->NeedsEvaluation)
......
......@@ -100,7 +100,7 @@ public:
~cmCompiledGeneratorExpression();
std::string GetInput() const
std::string const& GetInput() const
{
return this->Input;
}
......@@ -116,7 +116,7 @@ public:
private:
cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace,
const char *input);
const std::string& input);
friend class cmGeneratorExpression;
......
......@@ -32,13 +32,11 @@ static void InsertText(const char *upto, const char *c,
//----------------------------------------------------------------------------
std::vector<cmGeneratorExpressionToken>
cmGeneratorExpressionLexer::Tokenize(const char *input)
cmGeneratorExpressionLexer::Tokenize(const std::string& input)
{
std::vector<cmGeneratorExpressionToken> result;
if (!input)
return result;
const char *c = input;
const char *c = input.c_str();
const char *upto = c;
for ( ; *c; ++c)
......
......@@ -43,7 +43,7 @@ class cmGeneratorExpressionLexer
public:
cmGeneratorExpressionLexer();
std::vector<cmGeneratorExpressionToken> Tokenize(const char *input);
std::vector<cmGeneratorExpressionToken> Tokenize(const std::string& input);
bool GetSawGeneratorExpression() const
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment