From f47540ed9a40598fa40d77f45d1fb3b051cd3a5a Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 15 Sep 2025 18:02:43 -0700 Subject: [PATCH] [Support] Consolidate has_FlowTraits in YAMLTraits.h (NFC) has_FlowTraits has two implementations: - "class has_FlowTraits" says false on non-class types. - "struct has_FlowTraits" checks for a "flow" member on class types. This patch eliminates the former because std::is_class is redundant if we are checking to see if &U::flow is well formed. The comment block being removed in this patch has been around since 2012. I'd assume that host compilers have improved since then. Note that we are now using is_detected, which wasn't the case back in 2012. --- llvm/include/llvm/Support/YAMLTraits.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h index bbc12a2fcbe7a..81e3e2e41e86d 100644 --- a/llvm/include/llvm/Support/YAMLTraits.h +++ b/llvm/include/llvm/Support/YAMLTraits.h @@ -442,15 +442,8 @@ template struct has_CustomMappingTraits { is_detected>::value; }; -// has_FlowTraits will cause an error with some compilers because -// it subclasses int. Using this wrapper only instantiates the -// real has_FlowTraits only if the template type is a class. -template > class has_FlowTraits { -public: - static constexpr bool value = false; -}; - -template struct has_FlowTraits { +// Test if flow is defined on type T. +template struct has_FlowTraits { template using check = decltype(&U::flow); static constexpr bool value = is_detected::value;