[all-commits] [llvm/llvm-project] 1ff88e: Always emit complete debug info for types which ap...

Clayton Knittel via All-commits all-commits at lists.llvm.org
Wed Sep 23 13:59:40 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1ff88ee1b0710bab455f1da22f7c7f7b36389cda
      https://github.com/llvm/llvm-project/commit/1ff88ee1b0710bab455f1da22f7c7f7b36389cda
  Author: Clayton Knittel <cknit1999 at gmail.com>
  Date:   2026-09-23 (Wed, 23 Sep 2026)

  Changed paths:
    M clang/lib/CodeGen/CGDebugInfo.cpp
    M clang/test/DebugInfo/CXX/limited-ctor.cpp

  Log Message:
  -----------
  Always emit complete debug info for types which appear as a member of a standard-layout union. (#224439)

[[class.mem]](https://timsong-cpp.github.io/cppwp/n3337/class.mem#19)
states:

> "If a standard-layout union contains two or more standard-layout
structs that share a common initial sequence, and if the standard-layout
union object currently contains one of these standard-layout structs, it
is permitted to inspect the common initial part of any of them. Two
standard-layout structs share a common initial sequence if corresponding
members have layout-compatible types and either neither member is a
bit-field or both are bit-fields with the same width for a sequence of
one or more initial members."

This makes it possible to obtain a reference to a type which was never
constructed, which violates the assumption made by constructor homing
that all types that may require debug info must be constructed.

This change takes the conservative approach of always emitting full
debug info for standard-layout types which appear as a member of a
standard-layout union somewhere in the TU. It could be made more
aggressive by only emitting full debug info if there is another type in
the union that shares a "common initial sequence", but that would add
complexity to this exclusion logic and likely isn't worth it.

---------

Signed-off-by: Clayton Knittel <cknit1999 at gmail.com>



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