[PATCH] D126803: [llvm][analyzer][NFC] Introduce SFINAE for specializing FoldingSetTraits
Balázs Benics via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 2 10:33:15 PDT 2022
steakhal added inline comments.
================
Comment at: llvm/include/llvm/ADT/FoldingSet.h:260
/// to FoldingSets that were not originally designed to have that behavior.
-template<typename T> struct FoldingSetTrait
- : public DefaultFoldingSetTrait<T> {};
+template <typename T, typename = /*For SFINAE*/ void>
+struct FoldingSetTrait : public DefaultFoldingSetTrait<T> {};
----------------
bzcheeseman wrote:
> supernit: I generally prefer named template parameters - can call it something like `Enable`?
Thanks!
================
Comment at: llvm/include/llvm/ADT/FoldingSet.h:834
+struct FoldingSetTrait<
+ T, typename std::enable_if_t<std::is_enum<T>::value, void>> {
+ static void Profile(const T &X, FoldingSetNodeID &ID) {
----------------
bzcheeseman wrote:
> supernit - the default type of std::enable_if_t is `void` so you don't need to specify it :)
Awesome!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126803/new/
https://reviews.llvm.org/D126803
More information about the cfe-commits
mailing list