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