Skip to content

Commit 3e0c58b

Browse files
authored
Revert "[IR] Simplify HasCachedHash with is_detected (NFC) (#159510)" (#159622)
This reverts commit d6b7ac8. Build breakages reported on the PR hint at not working with certain versions of the host compiler.
1 parent 3ad40d1 commit 3e0c58b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

llvm/lib/IR/Metadata.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,10 +986,15 @@ static T *uniquifyImpl(T *N, DenseSet<T *, InfoT> &Store) {
986986
}
987987

988988
template <class NodeTy> struct MDNode::HasCachedHash {
989+
using Yes = char[1];
990+
using No = char[2];
991+
template <class U, U Val> struct SFINAE {};
992+
989993
template <class U>
990-
using check = decltype(static_cast<void (U::*)(unsigned)>(&U::setHash));
994+
static Yes &check(SFINAE<void (U::*)(unsigned), &U::setHash> *);
995+
template <class U> static No &check(...);
991996

992-
static constexpr bool value = is_detected<check, NodeTy>::value;
997+
static const bool value = sizeof(check<NodeTy>(nullptr)) == sizeof(Yes);
993998
};
994999

9951000
MDNode *MDNode::uniquify() {

0 commit comments

Comments
 (0)