[llvm] 7d949ee - [Support] Use llvm::is_detected (NFC) (#158504)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 14 14:04:23 PDT 2025
Author: Kazu Hirata
Date: 2025-09-14T14:04:20-07:00
New Revision: 7d949ee04f9863093dc3605feeca931318b0a0cd
URL: https://github.com/llvm/llvm-project/commit/7d949ee04f9863093dc3605feeca931318b0a0cd
DIFF: https://github.com/llvm/llvm-project/commit/7d949ee04f9863093dc3605feeca931318b0a0cd.diff
LOG: [Support] Use llvm::is_detected (NFC) (#158504)
This patch uses llvm::is_detected to replace the old SFINAE-based
approach.
Added:
Modified:
llvm/include/llvm/Support/FormatVariadicDetails.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/FormatVariadicDetails.h b/llvm/include/llvm/Support/FormatVariadicDetails.h
index aaad226666aa1..fa11d56fc1ada 100644
--- a/llvm/include/llvm/Support/FormatVariadicDetails.h
+++ b/llvm/include/llvm/Support/FormatVariadicDetails.h
@@ -66,13 +66,10 @@ template <class T> class has_FormatProvider {
typedef void (*Signature_format)(const Decayed &, llvm::raw_ostream &,
StringRef);
- template <typename U>
- static char test(SameType<Signature_format, &U::format> *);
-
- template <typename U> static double test(...);
+ template <typename U> using check = SameType<Signature_format, &U::format>;
- static bool const value =
- (sizeof(test<llvm::format_provider<Decayed>>(nullptr)) == 1);
+ static constexpr bool value =
+ llvm::is_detected<check, llvm::format_provider<Decayed>>::value;
};
// Test if raw_ostream& << T -> raw_ostream& is findable via ADL.
More information about the llvm-commits
mailing list