<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - [CodeView] clang emits an incorrect LF_NESTTYPE record for unnamed enums."
href="https://bugs.llvm.org/show_bug.cgi?id=40100">40100</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[CodeView] clang emits an incorrect LF_NESTTYPE record for unnamed enums.
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>DebugInfo
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zturner@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com, rnk@google.com, zturner@google.com
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>