[PATCH] D135551: [clang] replace `assert(0)` with `llvm_unreachable` NFC

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 12:36:47 PDT 2022


dexonsmith added a comment.

I would think we could convert every assert(0) to either `llvm::report_fatal_error` (guaranteed trap) or `llvm_unreachable()` (trap or optimize, depending on CMAKE configuration). The C API usage checks seem like good candidates for the former.

Also, not sure if everyone noticed, but the latter can now be configured to always trap by turning off the “optimize” CMAKE flag. This seems useful for fuzzing situations where you may not want asserts builds.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135551



More information about the cfe-commits mailing list