<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68237>68237</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Cannot build `obj.clangAST` when `LLVM_UNREACHABLE_OPTIMIZATIONS` are turned off
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
MasterAwesome
</td>
</tr>
</table>
<pre>
I'm trying to build clang in `Release` mode with `LLVM_UNREACHABLE_OPTIMIZATIONS` turned off; however, the file `AttrImpl.cpp` fails to compile. This happens in `release/17.x` branch and `main`.
```bash
cmake llvm \
-DLLVM_ENABLE_PROJECTS=clang \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_ASM_COMPILER=clang \
-DLLVM_UNREACHABLE_OPTIMIZE=OFF \
-B build
cd build/
make obj.clangAST
```
This seems due to the fact that on `CMAKE_BUILD_TYPE=Release` + `LLVM_UNREACHABLE_OPTIMIZE=OFF` leads to https://github.com/llvm/llvm-project/blob/6cbf6f5d376a06d96bc1320e83d479749873c654/llvm/include/llvm/Support/ErrorHandling.h#L151-L154 branch which causes the tblgen'd output to not compile. All other variants work [(Release + `LLVM_UNREACHABLE_OPTIMIZE=ON`), (Debug + `LLVM_UNREACHABLE_OPTIMIZE=[ON|OFF]`)]
This is bisected to `clang-tblgen` change https://github.com/llvm/llvm-project/commit/b6d4d51f8f5aab311df34c753b925760578729bd#diff-58111c7c545672c3a67b1b31a37d4103b35d9c584a46c74b0be14cc37741491bR2642-R2646
Tested with both host toolchains `clang 17.0.2` and `gcc 13.2.0`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVUuP2zYQ_jX0hbAgkiIpHXzwE3Frrxe7TpH2suDLFhNKNEQqbv59QVnNJptsuwEMGR4Nx_M9hiNCsOf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