[PATCH] D129822: [Support] Workaround compiler bug in MSVC

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 17:04:35 PDT 2022


tstellar updated this revision to Diff 447887.
tstellar added a comment.

Fix typo.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129822

Files:
  llvm/lib/Support/NativeFormatting.cpp


Index: llvm/lib/Support/NativeFormatting.cpp
===================================================================
--- llvm/lib/Support/NativeFormatting.cpp
+++ llvm/lib/Support/NativeFormatting.cpp
@@ -262,5 +262,17 @@
   case FloatStyle::Percent:
     return 2; // Number of decimal places.
   }
+
+  // Workaround for MSVC bug in VS2022:
+  // https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317
+  // llvm_unreachable expands to __assume(false) with MSVC which triggers the
+  // bug.
+#if _MSC_VER >= 1930
+  // This function is typically used in !NDEBUG builds, but we need something
+  // here to avoid 'not all control paths return a value' warnings.
+  ::llvm::llvm_unreachable_internal("Unknown FloatStyle enum", __FILE__,
+                                    __LINE__);
+#else
   llvm_unreachable("Unknown FloatStyle enum");
+#endif
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129822.447887.patch
Type: text/x-patch
Size: 881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220727/907ba508/attachment.bin>


More information about the llvm-commits mailing list