[PATCH] D138326: [CodeView] Don't generate dummy unnamed strcut/class/union type.

Zequan Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 18 15:54:46 PST 2022


zequanwu added a comment.

In D138326#3938128 <https://reviews.llvm.org/D138326#3938128>, @rnk wrote:

> Since Clang creates the member list and only adds types for the benefit of codeview, should we change clang instead?

Yes, that's something clang does only for codeview, changed in clang side. It will still emit type info for unnamed records but not for anonymous records.



================
Comment at: llvm/test/DebugInfo/COFF/nested-types.ll:214
+; CHECK-NEXT:   }
 ; CHECK-NEXT:   NestedType {
 ; CHECK-NEXT:     TypeLeafKind: LF_NESTTYPE (0x1510)
----------------
rnk wrote:
> So the test shows that we don't have NestedType records for unnamed unions & structs, right?
Updated. We want NestedType records for unnamed unions & structs, but not for anonymous unions & structs. That's what MSVC does.
```
 0x1004 | LF_FIELDLIST [size = 168]
            - LF_MEMBER [name = `i1`, Type = 0x0074 (int), offset = 0, attrs = public]
            - LF_NESTTYPE [name = `<unnamed-type-unnamed_union>`, parent = 0x1002]
            - LF_MEMBER [name = `unnamed_union`, Type = 0x1002, offset = 4, attrs = public]
            - LF_MEMBER [name = `i3`, Type = 0x0074 (int), offset = 8, attrs = public]
            - LF_NESTTYPE [name = `<unnamed-type-unnamed_struct>`, parent = 0x1003]
            - LF_MEMBER [name = `unnamed_struct`, Type = 0x1003, offset = 12, attrs = public]
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138326/new/

https://reviews.llvm.org/D138326



More information about the cfe-commits mailing list