[clang] [clang][TypePrinter] Replace AppendScope with printNestedNameSpecifier (PR #168534)
Aiden Grossman via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 24 06:49:17 PST 2025
boomanaiden154 wrote:
It seems like this caused a regression in at least one case.
https://godbolt.org/z/bzY1qbboc
For a simple example:
```c++
typedef union {
struct {
unsigned int a : 1;
unsigned int b : 1;
unsigned int c : 1;
unsigned int d : 2;
unsigned int e : 1;
unsigned int f : 1;
unsigned int g : 1;
};
unsigned char val;
} session_u;
session_u bar;
```
We were getting the following (from `-fdump-record-layouts`):
```
0 | struct session_u::(anonymous at <source>:2:3)
0:0-0 | unsigned int a
0:1-1 | unsigned int b
0:2-2 | unsigned int c
0:3-4 | unsigned int d
0:5-5 | unsigned int e
0:6-6 | unsigned int f
0:7-7 | unsigned int g
| [sizeof=4, dsize=4, align=4,
| nvsize=4, nvalign=4]
```
But now we are getting the following:
```
*** Dumping AST Record Layout
0 | struct (anonymous union)::(anonymous at <source>:2:3)
0:0-0 | unsigned int a
0:1-1 | unsigned int b
0:2-2 | unsigned int c
0:3-4 | unsigned int d
0:5-5 | unsigned int e
0:6-6 | unsigned int f
0:7-7 | unsigned int g
| [sizeof=4, dsize=4, align=4,
| nvsize=4, nvalign=4]
```
Where the union is now listed as anonymous despite it being given a name.
https://github.com/llvm/llvm-project/pull/168534
More information about the cfe-commits
mailing list