cmGeneratorExpressionDAGChecker: introduce method Top()
This commit is contained in:
parent
40d1735681
commit
38332fc4fa
@ -48,12 +48,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
|
|||||||
|
|
||||||
void cmGeneratorExpressionDAGChecker::Initialize()
|
void cmGeneratorExpressionDAGChecker::Initialize()
|
||||||
{
|
{
|
||||||
const cmGeneratorExpressionDAGChecker* top = this;
|
const auto* top = this->Top();
|
||||||
const cmGeneratorExpressionDAGChecker* p = this->Parent;
|
|
||||||
while (p) {
|
|
||||||
top = p;
|
|
||||||
p = p->Parent;
|
|
||||||
}
|
|
||||||
this->CheckResult = this->CheckGraph();
|
this->CheckResult = this->CheckGraph();
|
||||||
|
|
||||||
#define TEST_TRANSITIVE_PROPERTY_METHOD(METHOD) top->METHOD() ||
|
#define TEST_TRANSITIVE_PROPERTY_METHOD(METHOD) top->METHOD() ||
|
||||||
@ -144,60 +139,34 @@ cmGeneratorExpressionDAGChecker::CheckGraph() const
|
|||||||
return DAG;
|
return DAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGeneratorExpressionDAGChecker::GetTransitivePropertiesOnly()
|
bool cmGeneratorExpressionDAGChecker::GetTransitivePropertiesOnly() const
|
||||||
{
|
{
|
||||||
const cmGeneratorExpressionDAGChecker* top = this;
|
return this->Top()->TransitivePropertiesOnly;
|
||||||
const cmGeneratorExpressionDAGChecker* parent = this->Parent;
|
|
||||||
while (parent) {
|
|
||||||
top = parent;
|
|
||||||
parent = parent->Parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
return top->TransitivePropertiesOnly;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGeneratorExpressionDAGChecker::EvaluatingGenexExpression()
|
bool cmGeneratorExpressionDAGChecker::EvaluatingGenexExpression() const
|
||||||
{
|
{
|
||||||
return cmHasLiteralPrefix(this->Property, "TARGET_GENEX_EVAL:") ||
|
return cmHasLiteralPrefix(this->Property, "TARGET_GENEX_EVAL:") ||
|
||||||
cmHasLiteralPrefix(this->Property, "GENEX_EVAL:");
|
cmHasLiteralPrefix(this->Property, "GENEX_EVAL:");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGeneratorExpressionDAGChecker::EvaluatingPICExpression()
|
bool cmGeneratorExpressionDAGChecker::EvaluatingPICExpression() const
|
||||||
{
|
{
|
||||||
const cmGeneratorExpressionDAGChecker* top = this;
|
return this->Top()->Property == "INTERFACE_POSITION_INDEPENDENT_CODE";
|
||||||
const cmGeneratorExpressionDAGChecker* parent = this->Parent;
|
|
||||||
while (parent) {
|
|
||||||
top = parent;
|
|
||||||
parent = parent->Parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
return top->Property == "INTERFACE_POSITION_INDEPENDENT_CODE";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkExpression()
|
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkExpression() const
|
||||||
{
|
{
|
||||||
const cmGeneratorExpressionDAGChecker* top = this;
|
cm::string_view property(this->Top()->Property);
|
||||||
const cmGeneratorExpressionDAGChecker* parent = this->Parent;
|
|
||||||
while (parent) {
|
|
||||||
top = parent;
|
|
||||||
parent = parent->Parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
cm::string_view property(top->Property);
|
|
||||||
|
|
||||||
return property == "LINK_DIRECTORIES"_s || property == "LINK_OPTIONS"_s ||
|
return property == "LINK_DIRECTORIES"_s || property == "LINK_OPTIONS"_s ||
|
||||||
property == "LINK_DEPENDS"_s;
|
property == "LINK_DEPENDS"_s;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(
|
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(
|
||||||
cmGeneratorTarget const* tgt)
|
cmGeneratorTarget const* tgt) const
|
||||||
{
|
{
|
||||||
const cmGeneratorExpressionDAGChecker* top = this;
|
const auto* top = this->Top();
|
||||||
const cmGeneratorExpressionDAGChecker* parent = this->Parent;
|
|
||||||
while (parent) {
|
|
||||||
top = parent;
|
|
||||||
parent = parent->Parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
cm::string_view prop(top->Property);
|
cm::string_view prop(top->Property);
|
||||||
|
|
||||||
@ -212,7 +181,8 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(
|
|||||||
prop == "INTERFACE_LINK_LIBRARIES"_s;
|
prop == "INTERFACE_LINK_LIBRARIES"_s;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmGeneratorTarget const* cmGeneratorExpressionDAGChecker::TopTarget() const
|
cmGeneratorExpressionDAGChecker const* cmGeneratorExpressionDAGChecker::Top()
|
||||||
|
const
|
||||||
{
|
{
|
||||||
const cmGeneratorExpressionDAGChecker* top = this;
|
const cmGeneratorExpressionDAGChecker* top = this;
|
||||||
const cmGeneratorExpressionDAGChecker* parent = this->Parent;
|
const cmGeneratorExpressionDAGChecker* parent = this->Parent;
|
||||||
@ -220,7 +190,12 @@ cmGeneratorTarget const* cmGeneratorExpressionDAGChecker::TopTarget() const
|
|||||||
top = parent;
|
top = parent;
|
||||||
parent = parent->Parent;
|
parent = parent->Parent;
|
||||||
}
|
}
|
||||||
return top->Target;
|
return top;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmGeneratorTarget const* cmGeneratorExpressionDAGChecker::TopTarget() const
|
||||||
|
{
|
||||||
|
return this->Top()->Target;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TransitiveProperty
|
enum TransitiveProperty
|
||||||
|
@ -66,10 +66,11 @@ struct cmGeneratorExpressionDAGChecker
|
|||||||
void ReportError(cmGeneratorExpressionContext* context,
|
void ReportError(cmGeneratorExpressionContext* context,
|
||||||
const std::string& expr);
|
const std::string& expr);
|
||||||
|
|
||||||
bool EvaluatingGenexExpression();
|
bool EvaluatingGenexExpression() const;
|
||||||
bool EvaluatingPICExpression();
|
bool EvaluatingPICExpression() const;
|
||||||
bool EvaluatingLinkExpression();
|
bool EvaluatingLinkExpression() const;
|
||||||
bool EvaluatingLinkLibraries(cmGeneratorTarget const* tgt = nullptr);
|
|
||||||
|
bool EvaluatingLinkLibraries(cmGeneratorTarget const* tgt = nullptr) const;
|
||||||
|
|
||||||
#define DECLARE_TRANSITIVE_PROPERTY_METHOD(METHOD) bool METHOD() const;
|
#define DECLARE_TRANSITIVE_PROPERTY_METHOD(METHOD) bool METHOD() const;
|
||||||
|
|
||||||
@ -77,9 +78,10 @@ struct cmGeneratorExpressionDAGChecker
|
|||||||
|
|
||||||
#undef DECLARE_TRANSITIVE_PROPERTY_METHOD
|
#undef DECLARE_TRANSITIVE_PROPERTY_METHOD
|
||||||
|
|
||||||
bool GetTransitivePropertiesOnly();
|
bool GetTransitivePropertiesOnly() const;
|
||||||
void SetTransitivePropertiesOnly() { this->TransitivePropertiesOnly = true; }
|
void SetTransitivePropertiesOnly() { this->TransitivePropertiesOnly = true; }
|
||||||
|
|
||||||
|
cmGeneratorExpressionDAGChecker const* Top() const;
|
||||||
cmGeneratorTarget const* TopTarget() const;
|
cmGeneratorTarget const* TopTarget() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user