[clang] [clang][driver] Expose a frontend option for trap-unreachable (PR #174894)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 15 09:16:02 PST 2026


================
@@ -4693,6 +4693,16 @@ defm strict_return : BoolFOption<"strict-return",
             " of a non-void function as unreachable">,
   PosFlag<SetTrue>>;
 
+def ftrap_unreachable
+    : Joined<["-"], "ftrap-unreachable=">,
+      Group<f_Group>,
+      Visibility<[ClangOption, CC1Option]>,
+      HelpText<"Replace ``llvm.unreachable`` instructions with traps, when it is supported and profitable.">,
----------------
MaskRay wrote:

We omit the trailing `.`. If more text is needed, consider adding it to https://clang.llvm.org/docs/UsersManual.html#controlling-code-generation near https://clang.llvm.org/docs/UsersManual.html#cmdoption-ftrap-function

https://github.com/llvm/llvm-project/pull/174894


More information about the cfe-commits mailing list