This is an archive of the discontinued LLVM Phabricator instance.

[M68k][NFC] Rename M68kOperand::Kind to KindTy
ClosedPublic

Authored by ricky26 on Aug 25 2021, 12:53 PM.

Details

Summary

Rename the M68kOperand::Type enumeration to KindTy to avoid ambiguity
with the Kind field when referencing enumeration values e.g.
Kind::Value.

This works around a compilation error under GCC 5, where GCC won't
lookup enum class values if you have a similarly named field
(see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60994).

The error in question is:
M68kAsmParser.cpp:857:8: error: 'Kind' is not a class, namespace, or enumeration

Diff Detail

Event Timeline

ricky26 created this revision.Aug 25 2021, 12:53 PM
ricky26 requested review of this revision.Aug 25 2021, 12:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2021, 12:53 PM
glaubitz added a reviewer: jrtc27.EditedAug 25 2021, 12:58 PM
glaubitz added a subscriber: jrtc27.

As suggested here [1] by @jrtc27, I think the better solution is to rename the enum Kind to KindTy.

[1] https://github.com/rust-lang/rust/pull/88321#discussion_r696043053

Edit: Rename because that would match the naming scheme also used by the RISCV AsmParser.

As suggested here [1] by @jrtc27, I think the better solution is to rename the enum Kind to KindTy.

[1] https://github.com/rust-lang/rust/pull/88321#discussion_r696043053

Edit: Rename because that would match the naming scheme also used by the RISCV AsmParser.

Ah, I missed that comment. I agree, I'll swap it over. Thanks for adding in @jrtc27.

ricky26 updated this revision to Diff 368712.Aug 25 2021, 1:18 PM

Change over to using KindTy as the name of the enumeration.

Commit message needs updating, and should probably also be clearer that it's a workaround for a bug, perhaps linking to the bug in question too. Patch itself looks fine and boring.

ricky26 updated this revision to Diff 368715.Aug 25 2021, 1:36 PM
ricky26 edited the summary of this revision. (Show Details)

Update the commit message.

Subject too please; message looks good now.

ricky26 updated this revision to Diff 368730.Aug 25 2021, 2:21 PM
ricky26 retitled this revision from [M68k][NFC] Fix enum references in the asm parser to [M68k][NFC] Rename M68kOperand::Kind to KindTy.

Make the commit title more precise.

jrtc27 accepted this revision.Aug 25 2021, 2:23 PM

Thanks

This revision is now accepted and ready to land.Aug 25 2021, 2:23 PM
This revision was landed with ongoing or failed builds.Aug 25 2021, 2:25 PM
This revision was automatically updated to reflect the committed changes.