cmGeneratorExpression: Tokenize over strings

This commit is contained in:
Ben Boeckel 2014-02-08 12:01:01 -05:00 committed by Brad King
parent f0ad6631ad
commit cfc2cf9559
4 changed files with 13 additions and 15 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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)

View File

@ -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
{