Skip to content

Conversation

kazutakahirata
Copy link
Contributor

This patch modernizes has_* YAML traits with is_detected.

The resulting code should be a lot more readable because all the
SFINAE logic is hidden behind is_detected.

One note about has_FlowTraits. The original code uses a complex trick
to detect a member variable named "flow", intentionally triggering
ambiguity with "flow" in the two base classes. I've simplified the
check down to:

template using check = decltype(&U::flow);

without using SameType. The use of SameType here would make the trait
unnecessarily complicated.

While I am at it, this patch switches to "static constexpr bool".

This patch modernizes has_* YAML traits with is_detected.

The resulting code should be a lot more readable because all the
SFINAE logic is hidden behind is_detected.

One note about has_FlowTraits.  The original code uses a complex trick
to detect a member variable named "flow", intentionally triggering
ambiguity with "flow" in the two base classes.  I've simplified the
check down to:

  template <class U> using check = decltype(&U::flow);

without using SameType.  The use of SameType here would make the trait
unnecessarily complicated.

While I am at it, this patch switches to "static constexpr bool".
@kazutakahirata kazutakahirata merged commit 07e3004 into llvm:main Sep 3, 2025
9 of 10 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250902_YAMLTraits_is_detected branch September 3, 2025 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants