Skip to content

Commit 7d949ee

Browse files
[Support] Use llvm::is_detected (NFC) (#158504)
This patch uses llvm::is_detected to replace the old SFINAE-based approach.
1 parent 0e36aa1 commit 7d949ee

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

llvm/include/llvm/Support/FormatVariadicDetails.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,10 @@ template <class T> class has_FormatProvider {
6666
typedef void (*Signature_format)(const Decayed &, llvm::raw_ostream &,
6767
StringRef);
6868

69-
template <typename U>
70-
static char test(SameType<Signature_format, &U::format> *);
71-
72-
template <typename U> static double test(...);
69+
template <typename U> using check = SameType<Signature_format, &U::format>;
7370

74-
static bool const value =
75-
(sizeof(test<llvm::format_provider<Decayed>>(nullptr)) == 1);
71+
static constexpr bool value =
72+
llvm::is_detected<check, llvm::format_provider<Decayed>>::value;
7673
};
7774

7875
// Test if raw_ostream& << T -> raw_ostream& is findable via ADL.

0 commit comments

Comments
 (0)