[llvm-bugs] [Bug 40100] New: [CodeView] clang emits an incorrect LF_NESTTYPE record for unnamed enums.
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Dec 19 10:44:26 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=40100
Bug ID: 40100
Summary: [CodeView] clang emits an incorrect LF_NESTTYPE record
for unnamed enums.
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: DebugInfo
Assignee: unassignedbugs at nondot.org
Reporter: zturner at google.com
CC: jdevlieghere at apple.com, keith.walker at arm.com,
llvm-bugs at lists.llvm.org,
paul_robinson at playstation.sony.com, rnk at google.com,
zturner at google.com
Consider this code:
struct SS {
constexpr SS() {}
struct {
int X = 3;
} UnnamedStructInstance;
enum {
Enumerator1 = 0,
Enumerator2 = 1
} UnnamedEnumInstance = Enumerator1;
union {
int A = 0;
short B;
} UnnamedUnionInstance;
};
If we build this with clang and lld-link, then run `llvm-pdbutil dump -types`
on it, the relevant CodeView records that we emit will look like this:
0x1028 | LF_STRUCTURE [size = 112] `SS::<unnamed-type-UnnamedStructInstance>`
unique name: `.?AU<unnamed-type-UnnamedStructInstance>@SS@@`
vtable: <no type>, base list: <no type>, field list: <no type>
options: forward ref (-> 0x1032) | has unique name | is nested,
sizeof 0
0x102A | LF_ENUM [size = 80] `SS::<unnamed-tag>`
unique name: `.?AW4<unnamed-type-UnnamedEnumInstance>@SS@@`
field list: 0x1029, underlying type: 0x0074 (int)
options: has unique name | is nested
0x102B | LF_UNION [size = 100] `SS::<unnamed-type-UnnamedUnionInstance>`
unique name: `.?AT<unnamed-type-UnnamedUnionInstance>@SS@@`
field list: <no type>
options: forward ref (-> 0x1034) | has unique name | is nested,
sizeof 0
0x102F | LF_FIELDLIST [size = 216]
- LF_MEMBER [name = `UnnamedStructInstance`, Type = 0x1028, offset =
0, attrs = public]
- LF_MEMBER [name = `UnnamedEnumInstance`, Type = 0x102A, offset =
4, attrs = public]
- LF_MEMBER [name = `UnnamedUnionInstance`, Type = 0x102B, offset =
8, attrs = public]
- LF_ONEMETHOD [name = `SS`]
type = 0x102E, vftable offset = -1, attrs = public
- LF_NESTTYPE [name = `<unnamed-type-UnnamedStructInstance>`, parent
= 0x1028]
- LF_NESTTYPE [name = ``, parent = 0x102A]
- LF_NESTTYPE [name = `<unnamed-type-UnnamedUnionInstance>`, parent
= 0x102B]
Note that we've correctly emitted an LF_STRUCTURE, LF_ENUM, and LF_UNION with
names and unique names that include the "<unnamed-type-" prefix.
However, in the LF_FIELDLIST only the LF_NESTTYPES for the structure and enum
have the name field set. The one that points to the LF_ENUM has an empty name.
It should say <unnamed-type-UnnamedEnumInstance>.
This prevents LLDB from building a proper AST for these nested unnamed enums.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181219/adbab777/attachment-0001.html>
More information about the llvm-bugs
mailing list