[PATCH] D131337: Wrap `llvm_unreachable` macro in do-while loop

Stefan Gränitz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 04:16:17 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7a66fe1075cf: Wrap `llvm_unreachable` macro in do-while loop (authored by sgraenitz).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131337

Files:
  llvm/include/llvm/Support/ErrorHandling.h


Index: llvm/include/llvm/Support/ErrorHandling.h
===================================================================
--- llvm/include/llvm/Support/ErrorHandling.h
+++ llvm/include/llvm/Support/ErrorHandling.h
@@ -147,7 +147,11 @@
 #elif LLVM_UNREACHABLE_OPTIMIZE
 #define llvm_unreachable(msg) LLVM_BUILTIN_UNREACHABLE
 #else
-#define llvm_unreachable(msg) LLVM_BUILTIN_TRAP, LLVM_BUILTIN_UNREACHABLE
+#define llvm_unreachable(msg)                                                  \
+  do {                                                                         \
+    LLVM_BUILTIN_TRAP;                                                         \
+    LLVM_BUILTIN_UNREACHABLE;                                                  \
+  } while (false)
 #endif
 
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131337.450763.patch
Type: text/x-patch
Size: 766 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220808/70b946d7/attachment.bin>


More information about the llvm-commits mailing list