[llvm-rc] Serialize MENU resources to .res files (serialization, pt 3).

Authored by mnbvmar on Sep 13 2017, 2:23 PM.



This allows MENU resources to be serialized.

MENU resource statement doc: msdn.microsoft.com/en-us/library/windows/desktop/aa381025.aspx
POPUP sub-statement doc: msdn.microsoft.com/en-us/library/windows/desktop/aa381030.aspx
MENUITEM sub-statement doc: msdn.microsoft.com/en-us/library/windows/desktop/aa381024.aspx
MENUHEADER structure: msdn.microsoft.com/en-us/library/windows/desktop/ms648018.aspx (and NORMALMENUITEM, POPUPMENUITEM structs).

Thanks for Nico Weber for his original work in this area.

Diff Detail

ecbeckmann added inline comments.Sep 13 2017, 3:42 PM
89 ↗(On Diff #115117)

hmm I'm not a fan of how, in addition to the actual representation of these flags in the .res, you have an "internal" representation where each of the lower 6 bits corresponds directly to a flag, and then have to convert between the two. Why not just keep everything in the .res flag representation? Then you wouldn't need to have "processFlags" because the flags would already be in the correct format. For logFlags you can iterate over the enum to compare. This can be done by putting the enum in a vector or using an enum class.

mnbvmar updated this revision to Diff 115156.Sep 13 2017, 6:32 PM

Rebase wrt patch D37841.

mnbvmar updated this revision to Diff 117052.Sep 28 2017, 1:49 PM

Rewritten binary .res expected output to ASCII format.

mnbvmar updated this revision to Diff 117056.Sep 28 2017, 2:16 PM

Some minor style changes.

rnk accepted this revision.Sep 28 2017, 4:19 PM


1 ↗(On Diff #117056)

I don't think you need to separate the .rc file from the FileCheck directives for these tests. You can embed comments in the .rc file with //. However, in order for lit to treat a .rc file as a test, you will need to create a lit.local.cfg file that does something like config.suffixes.append('.rc'). You can search the codebase for other examples of this.

This is probably best implemented as a follow-up change, though.

This revision is now accepted and ready to land.Sep 28 2017, 4:19 PM
This revision was automatically updated to reflect the committed changes.