cmGeneratorExpression: remove const char* overloads

This commit is contained in:
Vitaly Stakhovsky
2020-03-08 17:00:00 -04:00
parent 1bb7474aba
commit b0dc52704b
6 changed files with 7 additions and 30 deletions

View File

@@ -32,12 +32,6 @@ std::unique_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(
new cmCompiledGeneratorExpression(this->Backtrace, std::move(input))); new cmCompiledGeneratorExpression(this->Backtrace, std::move(input)));
} }
std::unique_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(
const char* input) const
{
return this->Parse(std::string(input ? input : ""));
}
std::string cmGeneratorExpression::Evaluate( std::string cmGeneratorExpression::Evaluate(
std::string input, cmLocalGenerator* lg, const std::string& config, std::string input, cmLocalGenerator* lg, const std::string& config,
cmGeneratorTarget const* headTarget, cmGeneratorTarget const* headTarget,
@@ -52,17 +46,6 @@ std::string cmGeneratorExpression::Evaluate(
return input; return input;
} }
std::string cmGeneratorExpression::Evaluate(
const char* input, cmLocalGenerator* lg, const std::string& config,
cmGeneratorTarget const* headTarget,
cmGeneratorExpressionDAGChecker* dagChecker,
cmGeneratorTarget const* currentTarget, std::string const& language)
{
return input ? Evaluate(std::string(input), lg, config, headTarget,
dagChecker, currentTarget, language)
: "";
}
const std::string& cmCompiledGeneratorExpression::Evaluate( const std::string& cmCompiledGeneratorExpression::Evaluate(
cmLocalGenerator* lg, const std::string& config, cmLocalGenerator* lg, const std::string& config,
const cmGeneratorTarget* headTarget, const cmGeneratorTarget* headTarget,

View File

@@ -42,8 +42,6 @@ public:
std::unique_ptr<cmCompiledGeneratorExpression> Parse( std::unique_ptr<cmCompiledGeneratorExpression> Parse(
std::string input) const; std::string input) const;
std::unique_ptr<cmCompiledGeneratorExpression> Parse(
const char* input) const;
static std::string Evaluate( static std::string Evaluate(
std::string input, cmLocalGenerator* lg, const std::string& config, std::string input, cmLocalGenerator* lg, const std::string& config,
@@ -51,12 +49,6 @@ public:
cmGeneratorExpressionDAGChecker* dagChecker = nullptr, cmGeneratorExpressionDAGChecker* dagChecker = nullptr,
cmGeneratorTarget const* currentTarget = nullptr, cmGeneratorTarget const* currentTarget = nullptr,
std::string const& language = std::string()); std::string const& language = std::string());
static std::string Evaluate(
const char* input, cmLocalGenerator* lg, const std::string& config,
cmGeneratorTarget const* headTarget = nullptr,
cmGeneratorExpressionDAGChecker* dagChecker = nullptr,
cmGeneratorTarget const* currentTarget = nullptr,
std::string const& language = std::string());
enum PreprocessContext enum PreprocessContext
{ {

View File

@@ -676,7 +676,8 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
for (std::string const& i : configs) { for (std::string const& i : configs) {
const char* propertyValue = const char* propertyValue =
target->Target->GetMakefile()->GetDefinition(propertyName); target->Target->GetMakefile()->GetDefinition(propertyName);
if (cmIsOn(cmGeneratorExpression::Evaluate( if (propertyValue &&
cmIsOn(cmGeneratorExpression::Evaluate(
propertyValue, target->GetLocalGenerator(), i))) { propertyValue, target->GetLocalGenerator(), i))) {
activeConfigs.insert(i); activeConfigs.insert(i);
} }

View File

@@ -2411,8 +2411,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string attribute = prop.substr(16); std::string attribute = prop.substr(16);
this->FilterConfigurationAttribute(configName, attribute); this->FilterConfigurationAttribute(configName, attribute);
if (!attribute.empty()) { if (!attribute.empty()) {
const char* pr = gtgt->GetProperty(prop);
std::string processed = cmGeneratorExpression::Evaluate( std::string processed = cmGeneratorExpression::Evaluate(
gtgt->GetProperty(prop), this->CurrentLocalGenerator, configName); pr ? pr : "", this->CurrentLocalGenerator, configName);
buildSettings->AddAttribute(attribute, buildSettings->AddAttribute(attribute,
this->CreateString(processed)); this->CreateString(processed));
} }
@@ -3147,7 +3148,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
this->FilterConfigurationAttribute(config.first, attribute); this->FilterConfigurationAttribute(config.first, attribute);
if (!attribute.empty()) { if (!attribute.empty()) {
std::string processed = cmGeneratorExpression::Evaluate( std::string processed = cmGeneratorExpression::Evaluate(
this->CurrentMakefile->GetDefinition(var), this->CurrentMakefile->GetSafeDefinition(var),
this->CurrentLocalGenerator, config.first); this->CurrentLocalGenerator, config.first);
buildSettingsForCfg->AddAttribute(attribute, buildSettingsForCfg->AddAttribute(attribute,
this->CreateString(processed)); this->CreateString(processed));

View File

@@ -56,7 +56,7 @@ void cmInstalledFile::AppendProperty(cmMakefile const* mf,
cmGeneratorExpression ge(backtrace); cmGeneratorExpression ge(backtrace);
Property& property = this->Properties[prop]; Property& property = this->Properties[prop];
property.ValueExpressions.push_back(ge.Parse(value)); property.ValueExpressions.push_back(ge.Parse(value ? value : ""));
} }
bool cmInstalledFile::HasProperty(const std::string& prop) const bool cmInstalledFile::HasProperty(const std::string& prop) const

View File

@@ -155,7 +155,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
// Evaluates generator expressions and expands prop_value // Evaluates generator expressions and expands prop_value
auto evaluatedFiles = auto evaluatedFiles =
[this](const char* prop_value) -> std::vector<std::string> { [this](const std::string& prop_value) -> std::vector<std::string> {
std::vector<std::string> files; std::vector<std::string> files;
cmExpandList(cmGeneratorExpression::Evaluate( cmExpandList(cmGeneratorExpression::Evaluate(
prop_value, this->LocalGenerator, this->GetConfigName(), prop_value, this->LocalGenerator, this->GetConfigName(),