cmGeneratorExpression: Consolidate recognition of transitive properties
This commit is contained in:
parent
5f7d8192da
commit
895efd4e7a
@ -37,16 +37,19 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
|
|||||||
, Content(content)
|
, Content(content)
|
||||||
, Backtrace(std::move(backtrace))
|
, Backtrace(std::move(backtrace))
|
||||||
{
|
{
|
||||||
const auto* top = this->Top;
|
if (parent) {
|
||||||
|
this->TopIsTransitiveProperty = parent->TopIsTransitiveProperty;
|
||||||
|
} else {
|
||||||
|
#define TEST_TRANSITIVE_PROPERTY_METHOD(METHOD) this->METHOD() ||
|
||||||
|
this->TopIsTransitiveProperty = (CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(
|
||||||
|
TEST_TRANSITIVE_PROPERTY_METHOD) false); // NOLINT(*)
|
||||||
|
#undef TEST_TRANSITIVE_PROPERTY_METHOD
|
||||||
|
}
|
||||||
|
|
||||||
this->CheckResult = this->CheckGraph();
|
this->CheckResult = this->CheckGraph();
|
||||||
|
|
||||||
#define TEST_TRANSITIVE_PROPERTY_METHOD(METHOD) top->METHOD() ||
|
if (this->CheckResult == DAG && this->EvaluatingTransitiveProperty()) {
|
||||||
|
const auto* top = this->Top;
|
||||||
if (this->CheckResult == DAG &&
|
|
||||||
(CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(
|
|
||||||
TEST_TRANSITIVE_PROPERTY_METHOD) false)) // NOLINT(*)
|
|
||||||
#undef TEST_TRANSITIVE_PROPERTY_METHOD
|
|
||||||
{
|
|
||||||
auto it = top->Seen.find(this->Target);
|
auto it = top->Seen.find(this->Target);
|
||||||
if (it != top->Seen.end()) {
|
if (it != top->Seen.end()) {
|
||||||
const std::set<std::string>& propSet = it->second;
|
const std::set<std::string>& propSet = it->second;
|
||||||
@ -139,6 +142,11 @@ bool cmGeneratorExpressionDAGChecker::GetTransitivePropertiesOnlyCMP0131()
|
|||||||
return this->Top->CMP0131;
|
return this->Top->CMP0131;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cmGeneratorExpressionDAGChecker::EvaluatingTransitiveProperty() const
|
||||||
|
{
|
||||||
|
return this->TopIsTransitiveProperty;
|
||||||
|
}
|
||||||
|
|
||||||
bool cmGeneratorExpressionDAGChecker::EvaluatingGenexExpression() const
|
bool cmGeneratorExpressionDAGChecker::EvaluatingGenexExpression() const
|
||||||
{
|
{
|
||||||
// Corresponds to GenexEvaluator::EvaluateExpression.
|
// Corresponds to GenexEvaluator::EvaluateExpression.
|
||||||
|
@ -66,6 +66,7 @@ struct cmGeneratorExpressionDAGChecker
|
|||||||
void ReportError(cmGeneratorExpressionContext* context,
|
void ReportError(cmGeneratorExpressionContext* context,
|
||||||
const std::string& expr);
|
const std::string& expr);
|
||||||
|
|
||||||
|
bool EvaluatingTransitiveProperty() const;
|
||||||
bool EvaluatingGenexExpression() const;
|
bool EvaluatingGenexExpression() const;
|
||||||
bool EvaluatingPICExpression() const;
|
bool EvaluatingPICExpression() const;
|
||||||
bool EvaluatingCompileExpression() const;
|
bool EvaluatingCompileExpression() const;
|
||||||
@ -109,4 +110,5 @@ private:
|
|||||||
Result CheckResult;
|
Result CheckResult;
|
||||||
bool TransitivePropertiesOnly = false;
|
bool TransitivePropertiesOnly = false;
|
||||||
bool CMP0131 = false;
|
bool CMP0131 = false;
|
||||||
|
bool TopIsTransitiveProperty = false;
|
||||||
};
|
};
|
||||||
|
@ -2916,10 +2916,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
|
|||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#define ASSERT_TRANSITIVE_PROPERTY_METHOD(METHOD) dagCheckerParent->METHOD() ||
|
assert(dagCheckerParent
|
||||||
assert(CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(
|
->EvaluatingTransitiveProperty()); // NOLINT(clang-tidy)
|
||||||
ASSERT_TRANSITIVE_PROPERTY_METHOD) false); // NOLINT(clang-tidy)
|
|
||||||
#undef ASSERT_TRANSITIVE_PROPERTY_METHOD
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user