[lldb][TypeSystemClang] Fix enum signedness in CompleteEnumType #125203
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried using
CompleteEnumType
to replace some duplicated code inDWARFASTParserClang::ParseEnum
but tests started failing.CompleteEnumType
parses/attaches the child enumerators using the signedness it got fromCompilerType::IsIntegerType
. However, this would only report the correct signedness for builtin integer types (never forclang::EnumType
s). We have a different API for that inCompilerType::IsIntegerOrEnumerationType
which could've been used there instead. This patch callsIsEnumerationIntegerTypeSigned
to determine signedness because we always pass an enum type intoCompleteEnumType
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 throughCompleteEnumType
.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 inParseEnum
(at which point we already callCompleteEnumType
). The only other place we callCompleteEnumType
at is inCompleteTypeFromDWARF
. 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 toCompleteEnumType
in a follow-up.