summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorDaniel Eiband <daniel.eiband@brainlab.com>2019-09-22 00:06:45 +0200
committerDaniel Eiband <daniel.eiband@brainlab.com>2019-09-22 09:51:19 +0200
commitc12222db86859a5a5ce9163a5309bb0da10ec616 (patch)
tree674d778541027e2430ffe25a8155ad1aa2a44491 /Source
parent1811411fecf3d9769ad7a13f6ecd01c5351df9c4 (diff)
downloadcmake-c12222db86859a5a5ce9163a5309bb0da10ec616.tar.gz
cmGeneratorExpression: Remove Evaluate overload by parameter re-ordering
Simplify by re-ordering parameters of cmCompiledGeneratorExpression::Evaluate so that frequently used parameters are before less frequently used parameters. This allows with little extra arguments to get rid of one Evaluate overload, which makes it easier to implement the cmGeneratorExpression::Evaluate utility. The latter would otherwise need four overloads.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx2
-rw-r--r--Source/cmGeneratorExpression.cxx14
-rw-r--r--Source/cmGeneratorExpression.h7
-rw-r--r--Source/cmGeneratorExpressionNode.cxx16
-rw-r--r--Source/cmGeneratorExpressionNode.h4
-rw-r--r--Source/cmGeneratorTarget.cxx17
6 files changed, 23 insertions, 37 deletions
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index 585236041c..4027d4bfd8 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -75,7 +75,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());
std::string result = cge->Evaluate(tgt->GetLocalGenerator(), this->Config,
- &gDummyHead, tgt, &dagChecker, language);
+ &gDummyHead, &dagChecker, tgt, language);
const std::set<cmGeneratorTarget const*>& allTargets =
cge->GetAllTargetsSeen();
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 9472d9a5ab..1bc3452a3f 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -40,17 +40,7 @@ const std::string& cmCompiledGeneratorExpression::Evaluate(
cmLocalGenerator* lg, const std::string& config,
const cmGeneratorTarget* headTarget,
cmGeneratorExpressionDAGChecker* dagChecker,
- std::string const& language) const
-{
- return this->Evaluate(lg, config, headTarget, headTarget, dagChecker,
- language);
-}
-
-const std::string& cmCompiledGeneratorExpression::Evaluate(
- cmLocalGenerator* lg, const std::string& config,
- const cmGeneratorTarget* headTarget, const cmGeneratorTarget* currentTarget,
- cmGeneratorExpressionDAGChecker* dagChecker,
- std::string const& language) const
+ const cmGeneratorTarget* currentTarget, std::string const& language) const
{
cmGeneratorExpressionContext context(
lg, config, this->Quiet, headTarget,
@@ -391,7 +381,7 @@ const std::string& cmGeneratorExpressionInterpreter::Evaluate(
nullptr);
return this->CompiledGeneratorExpression->Evaluate(
- this->LocalGenerator, this->Config, this->HeadTarget, &dagChecker,
+ this->LocalGenerator, this->Config, this->HeadTarget, &dagChecker, nullptr,
this->Language);
}
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 7ed024a3d3..322bf5c117 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -90,13 +90,8 @@ public:
const std::string& Evaluate(
cmLocalGenerator* lg, const std::string& config,
cmGeneratorTarget const* headTarget = nullptr,
- cmGeneratorTarget const* currentTarget = nullptr,
cmGeneratorExpressionDAGChecker* dagChecker = nullptr,
- std::string const& language = std::string()) const;
- const std::string& Evaluate(
- cmLocalGenerator* lg, const std::string& config,
- cmGeneratorTarget const* headTarget,
- cmGeneratorExpressionDAGChecker* dagChecker,
+ cmGeneratorTarget const* currentTarget = nullptr,
std::string const& language = std::string()) const;
/** Get set of targets found during evaluations. */
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 419a82cd84..641cbaf762 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -45,15 +45,15 @@
std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
std::string const& prop, cmLocalGenerator* lg,
cmGeneratorExpressionContext* context, cmGeneratorTarget const* headTarget,
- cmGeneratorTarget const* currentTarget,
- cmGeneratorExpressionDAGChecker* dagChecker)
+ cmGeneratorExpressionDAGChecker* dagChecker,
+ cmGeneratorTarget const* currentTarget)
{
cmGeneratorExpression ge(context->Backtrace);
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem);
cge->SetQuiet(context->Quiet);
std::string result =
- cge->Evaluate(lg, context->Config, headTarget, currentTarget, dagChecker,
+ cge->Evaluate(lg, context->Config, headTarget, dagChecker, currentTarget,
context->Language);
if (cge->GetHadContextSensitiveCondition()) {
context->HadContextSensitiveCondition = true;
@@ -478,13 +478,13 @@ protected:
}
return this->EvaluateDependentExpression(
- expression, context->LG, context, context->HeadTarget,
- context->CurrentTarget, &dagChecker);
+ expression, context->LG, context, context->HeadTarget, &dagChecker,
+ context->CurrentTarget);
}
return this->EvaluateDependentExpression(
- expression, context->LG, context, context->HeadTarget,
- context->CurrentTarget, dagCheckerParent);
+ expression, context->LG, context, context->HeadTarget, dagCheckerParent,
+ context->CurrentTarget);
}
};
@@ -1332,7 +1332,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if (!interfacePropertyName.empty()) {
result = this->EvaluateDependentExpression(result, context->LG, context,
- target, target, &dagChecker);
+ target, &dagChecker, target);
std::string linkedTargetsContent = getLinkedTargetsContent(
target, interfacePropertyName, context, &dagChecker);
if (!linkedTargetsContent.empty()) {
diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h
index 7a369249fd..13e8484ef7 100644
--- a/Source/cmGeneratorExpressionNode.h
+++ b/Source/cmGeneratorExpressionNode.h
@@ -43,8 +43,8 @@ struct cmGeneratorExpressionNode
static std::string EvaluateDependentExpression(
std::string const& prop, cmLocalGenerator* lg,
cmGeneratorExpressionContext* context, const cmGeneratorTarget* headTarget,
- const cmGeneratorTarget* currentTarget,
- cmGeneratorExpressionDAGChecker* dagChecker);
+ cmGeneratorExpressionDAGChecker* dagChecker,
+ const cmGeneratorTarget* currentTarget);
static const cmGeneratorExpressionNode* GetNode(
const std::string& identifier);
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 454bcbc98f..b66d9d5322 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -112,7 +112,8 @@ public:
cmGeneratorExpressionDAGChecker* dagChecker,
std::string const& language) const override
{
- return this->ge->Evaluate(lg, config, headTarget, dagChecker, language);
+ return this->ge->Evaluate(lg, config, headTarget, dagChecker, nullptr,
+ language);
}
cmListFileBacktrace GetBacktrace() const override
@@ -709,8 +710,8 @@ void handleSystemIncludesDep(cmLocalGenerator* lg,
if (const char* dirs =
depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES")) {
cmGeneratorExpression ge;
- cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, headTarget, depTgt,
- dagChecker, language),
+ cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, headTarget, dagChecker,
+ depTgt, language),
result);
}
if (!depTgt->IsImported() || excludeImported) {
@@ -720,8 +721,8 @@ void handleSystemIncludesDep(cmLocalGenerator* lg,
if (const char* dirs =
depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")) {
cmGeneratorExpression ge;
- cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, headTarget, depTgt,
- dagChecker, language),
+ cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, headTarget, dagChecker,
+ depTgt, language),
result);
}
}
@@ -1093,7 +1094,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
for (std::string const& it : this->Target->GetSystemIncludeDirectories()) {
cmGeneratorExpression ge;
cmExpandList(ge.Parse(it)->Evaluate(this->LocalGenerator, config, this,
- &dagChecker, language),
+ &dagChecker, nullptr, language),
result);
}
@@ -1199,7 +1200,7 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty(
if (const char* p = this->GetProperty(prop)) {
result = cmGeneratorExpressionNode::EvaluateDependentExpression(
- p, context->LG, context, headTarget, this, &dagChecker);
+ p, context->LG, context, headTarget, &dagChecker, this);
}
if (cmLinkInterfaceLibraries const* iface =
@@ -5287,7 +5288,7 @@ void cmGeneratorTarget::ExpandLinkItems(
std::vector<std::string> libs;
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
cmExpandList(
- cge->Evaluate(this->LocalGenerator, config, headTarget, this, &dagChecker),
+ cge->Evaluate(this->LocalGenerator, config, headTarget, &dagChecker, this),
libs);
this->LookupLinkItems(libs, cge->GetBacktrace(), items);
hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition();