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

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 8 01:51:58 PST 2026


================
@@ -466,6 +466,7 @@ static bool initTargetOptions(const CompilerInstance &CI,
   Options.Hotpatch = CodeGenOpts.HotPatch;
   Options.JMCInstrument = CodeGenOpts.JMCInstrument;
   Options.XCOFFReadOnlyPointers = CodeGenOpts.XCOFFReadOnlyPointers;
+  Options.TrapUnreachable = CodeGenOpts.TrapUnreachable;
----------------
nikic wrote:

Should we also enable NoTrapAfterNoreturn? (Alternatively we could have multiple modes like `-ftrap-unreachable=all` and `-ftrap-unreachable=except-noreturn` or so.)

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


More information about the cfe-commits mailing list