Commit ae570d5
authored
[lldb][TypeSystemClang] Fix enum signedness in CompleteEnumType (#125203)
I tried using `CompleteEnumType` to replace some duplicated code in
`DWARFASTParserClang::ParseEnum` but tests started failing.
`CompleteEnumType` parses/attaches the child enumerators using the
signedness it got from `CompilerType::IsIntegerType`. However, this
would only report the correct signedness for builtin integer types
(never for `clang::EnumType`s). We have a different API for that in
`CompilerType::IsIntegerOrEnumerationType` which could've been used
there instead. This patch calls `IsEnumerationIntegerTypeSigned` to
determine signedness because we always pass an enum type into
`CompleteEnumType` anyway.
Based on git history this has been the case for a long time, but
possibly never caused issues because `ParseEnum` was completing the
definition manually instead of through `CompleteEnumType`.
I couldn't find a good way to test `CompleteEnumType` on its own because
it expects an enum type to be passed to it, which only gets created in
`ParseEnum` (at which point we already call `CompleteEnumType`). The
only other place we call `CompleteEnumType` at is in
[`CompleteTypeFromDWARF`](https://github.com/llvm/llvm-project/blob/466217eb0334d467ec8e9b96c52ee988aaadc389/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp#L2260-L2262).
Though I think we don't actually ever end up calling into that codepath
because we eagerly complete enum definitions. Maybe we can remove that
call to `CompleteEnumType` in a follow-up.1 parent fcb1234 commit ae570d5
File tree
1 file changed
+7
-15
lines changed- lldb/source/Plugins/SymbolFile/DWARF
1 file changed
+7
-15
lines changedLines changed: 7 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1019 | 1019 | | |
1020 | 1020 | | |
1021 | 1021 | | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
| 1022 | + | |
1032 | 1023 | | |
1033 | 1024 | | |
1034 | 1025 | | |
| |||
2221 | 2212 | | |
2222 | 2213 | | |
2223 | 2214 | | |
| 2215 | + | |
| 2216 | + | |
2224 | 2217 | | |
2225 | | - | |
2226 | | - | |
2227 | | - | |
2228 | | - | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
2229 | 2221 | | |
2230 | | - | |
| 2222 | + | |
2231 | 2223 | | |
2232 | 2224 | | |
2233 | 2225 | | |
| |||
0 commit comments