[all-commits] [llvm/llvm-project] bb1b82: [clang][TypePrinter] Replace AppendScope with prin...

Michael Buch via All-commits all-commits at lists.llvm.org
Fri Nov 21 02:31:57 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bb1b82af395fe4a717c9b10948312e260b5ca666
      https://github.com/llvm/llvm-project/commit/bb1b82af395fe4a717c9b10948312e260b5ca666
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2025-11-21 (Fri, 21 Nov 2025)

  Changed paths:
    M clang/lib/AST/Decl.cpp
    M clang/lib/AST/TypePrinter.cpp
    M clang/test/ASTMerge/struct/test.c
    M clang/test/CXX/drs/cwg6xx.cpp
    M clang/test/Index/print-type.c
    M clang/test/Layout/ms-x86-alias-avoidance-padding.cpp
    M clang/test/Modules/compare-record.c
    M clang/test/SemaObjCXX/arc-0x.mm
    M clang/unittests/AST/TypePrinterTest.cpp

  Log Message:
  -----------
  [clang][TypePrinter] Replace AppendScope with printNestedNameSpecifier (#168534)

In debug-info we soon have the need to print names using the full scope
of the entity (see discussion in
https://github.com/llvm/llvm-project/pull/159592). Particularly, when a
structure is scoped inside a function, we'd like to emit the name as
`func()::foo`. `CGDebugInfo` uses the `TypePrinter` to print type names
into debug-info. However, `TypePrinter` stops (and ignores)
`DeclContext`s that are functions. I.e., it would just print `foo`.
Ideally it would behave the same way `printNestedNameSpecifier` does.
The FIXME in
https://github.com/llvm/llvm-project/blob/47c1aa4cef638c97b74f3afb7bed60e92bba1f90/clang/lib/AST/TypePrinter.cpp#L1520-L1521
motivated this patch.

See https://github.com/llvm/llvm-project/pull/168533 for how this will
be used by `CGDebugInfo`. The plan is to introduce a new
`PrintingPolicy` that prints anonymous entities using their full scope
(including function/anonymous scopes) and the mangling number.



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