[all-commits] [llvm/llvm-project] e02ffa: [clang][driver] Expose a frontend option for trap-...

Paul Kirth via All-commits all-commits at lists.llvm.org
Thu Feb 12 10:35:00 PST 2026


  Branch: refs/heads/users/ilovepi/clang-trap-unreachable
  Home:   https://github.com/llvm/llvm-project
  Commit: e02ffa1e6e7ef1a45c01814dc739ff0923c19880
      https://github.com/llvm/llvm-project/commit/e02ffa1e6e7ef1a45c01814dc739ff0923c19880
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2026-02-12 (Thu, 12 Feb 2026)

  Changed paths:
    M clang/include/clang/Basic/CodeGenOptions.def
    M clang/include/clang/Options/Options.td
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    A clang/test/CodeGen/X86/unreachable-trap.c
    M clang/test/Driver/clang_f_opts.c

  Log Message:
  -----------
  [clang][driver] Expose a frontend option for trap-unreachable

We have several issues that list surprising behavior around UB. In many
cases, this causes undesirable control flow, such as execution falling
through to the next function (or whatever is in memory) instead of
remaining within the bounds of the procedure. #174844, #48943, #146791,
and #137741 all discuss a host of related issues. In #174844, it was
mentioned that we have backend support for this for Rust, and at least
one big class of these issues could be addressed by exposing the option
to clang.

This patch adds a new driver option that does just that. For now, we're
leaving this option off by default, though we expect only small
differences in code size or performance as a result if it were to be
enabled. There will be an RFC in the future when we have more confidence
this should be the default configuration.

Fixes #174844


  Commit: 2ae9acd679add01182517cc29b5b9808a7a4c132
      https://github.com/llvm/llvm-project/commit/2ae9acd679add01182517cc29b5b9808a7a4c132
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2026-02-12 (Thu, 12 Feb 2026)

  Changed paths:
    M clang/include/clang/Basic/CodeGenOptions.def
    M clang/include/clang/Basic/CodeGenOptions.h
    M clang/include/clang/Options/Options.td
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/test/CodeGen/X86/unreachable-trap.c
    M clang/test/Driver/clang_f_opts.c

  Log Message:
  -----------
  Also support NoTrapAfterNoreturn


  Commit: 0c42530916027af9d5e9a43366991da66c267bf3
      https://github.com/llvm/llvm-project/commit/0c42530916027af9d5e9a43366991da66c267bf3
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2026-02-12 (Thu, 12 Feb 2026)

  Changed paths:
    M clang/include/clang/Options/Options.td
    M clang/lib/CodeGen/BackendUtil.cpp

  Log Message:
  -----------
  Fix formatting


  Commit: 7df580508c4b369164de32b521e590645239b1ab
      https://github.com/llvm/llvm-project/commit/7df580508c4b369164de32b521e590645239b1ab
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2026-02-12 (Thu, 12 Feb 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Options/Options.td

  Log Message:
  -----------
  Fix release notes and help text


  Commit: f067d343160891aed25e535ad7da6ac1e3d9b701
      https://github.com/llvm/llvm-project/commit/f067d343160891aed25e535ad7da6ac1e3d9b701
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2026-02-12 (Thu, 12 Feb 2026)

  Changed paths:
    M clang/include/clang/Options/Options.td

  Log Message:
  -----------
  Fix punctuation in option description


  Commit: aa02129d5c03fc43d459ae16a37804f53ba84a91
      https://github.com/llvm/llvm-project/commit/aa02129d5c03fc43d459ae16a37804f53ba84a91
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2026-02-12 (Thu, 12 Feb 2026)

  Changed paths:
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    M clang/test/Driver/clang_f_opts.c

  Log Message:
  -----------
  Make sure options are passed to the linker in LTO


Compare: https://github.com/llvm/llvm-project/compare/b864741c6bae...aa02129d5c03

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list