Wrap `llvm_unreachable` macro in do-while loop
Macros that expand into multiple terms can cause interesting preprocessor hickups depending on the context they are used in. https://github.com/llvm/llvm-project/issues/56867 reported a miscompilation of `llvm_unreachable(msg)` inside a `LLVM_DEBUG({ ... })` block. We were able to fix it by wrapping the expansion in a `do {} while(false)`. Differential Revision: https://reviews.llvm.org/D131337
Loading
Please sign in to comment