Skip to content

[llvm][AsmWriter] Don't skip zero-valued DwarfEnum MDField when ShouldSkipZero is not set #9962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

Michael137
Copy link

I ran into this whil working on a different patch where I'm emitting a zero-valued DWARF enum field which shouldn't be skipped.

This patch checks the (currently unused) ShouldSkipZero before deciding to skip printing this field. Based on git history this seems like an oversight from the initial refactor that introduced this. We have a similar check in printInt.

Wasn't sure how to best test this, but tests in an upcoming patch rely on this functionality (see llvm#126045).

Currently the only place ShouldSkipZero is set to false is when emitting the DW_LANG_ enum. But the language codes start at 0x1. So it never exercised this codepath (and we should probably just make it not pass this parameter).

…dSkipZero is not set

I ran into this whil working on a different patch where I'm emitting a zero-valued DWARF enum field which shouldn't be skipped.

This patch checks the (currently unused) `ShouldSkipZero` before deciding to skip printing this field. Based on git history this seems like an oversight from the initial refactor that introduced this. We have a similar check in `printInt`.

Wasn't sure how to best test this, but tests in an upcoming patch rely on this functionality (see llvm#126045).

Currently the only place `ShouldSkipZero` is set to `false` is when emitting the `DW_LANG_` enum. But the language codes start at `0x1`. So it never exercised this codepath (and we should probably just make it not pass this parameter).
@Michael137 Michael137 requested a review from a team as a code owner February 6, 2025 10:51
@Michael137
Copy link
Author

@swift-ci test

@adrian-prantl adrian-prantl merged commit 9c34ca1 into stable/20240723 Feb 6, 2025
3 checks passed
@adrian-prantl adrian-prantl deleted the llvm/mdfield-print-to-20240723 branch February 6, 2025 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants