[PATCH] D81554: [ADT] Allow IsSizeLessThanThresholdT for incomplete types. NFC

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 21:03:25 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG7d9a16241fdd: [ADT] Allow IsSizeLessThanThresholdT for incomplete types. NFC (authored by yrouban).

Changed prior to commit:
  https://reviews.llvm.org/D81554?vs=269799&id=286948#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81554/new/

https://reviews.llvm.org/D81554

Files:
  llvm/include/llvm/ADT/FunctionExtras.h


Index: llvm/include/llvm/ADT/FunctionExtras.h
===================================================================
--- llvm/include/llvm/ADT/FunctionExtras.h
+++ llvm/include/llvm/ADT/FunctionExtras.h
@@ -64,12 +64,12 @@
 protected:
   static constexpr size_t InlineStorageSize = sizeof(void *) * 3;
 
-  // MSVC has a bug and ICEs if we give it a particular dependent value
-  // expression as part of the `std::conditional` below. To work around this,
-  // we build that into a template struct's constexpr bool.
-  template <typename T> struct IsSizeLessThanThresholdT {
-    static constexpr bool value = sizeof(T) <= (2 * sizeof(void *));
-  };
+  template <typename T, class = void>
+  struct IsSizeLessThanThresholdT : std::false_type {};
+
+  template <typename T>
+  struct IsSizeLessThanThresholdT<
+      T, std::enable_if_t<sizeof(T) <= 2 * sizeof(void *)>> : std::true_type {};
 
   // Provide a type function to map parameters that won't observe extra copies
   // or moves and which are small enough to likely pass in register to values


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81554.286948.patch
Type: text/x-patch
Size: 1051 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200821/1e9486e8/attachment.bin>


More information about the llvm-commits mailing list