Page MenuHomePhabricator

[08/10] [WindowsResource] Remove use of global variables in WindowsResourceParser
ClosedPublic

Authored by mstorsjo on Tue, Aug 27, 12:11 PM.

Details

Summary

Instead of updating a global variable counter for the next index of strings and data blobs, pass along a reference to actual string vector and let the TreeNode insertion methods add their strings to the vector when a new entry is needed.

Additionally, if the resource tree had duplicates, that were ignored with -force:multipleres in lld, we no longer store all versions of the duplicated resource data, now we only keep the one that actually ends up referenced.

Diff Detail

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.Tue, Aug 27, 12:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptTue, Aug 27, 12:11 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
mstorsjo updated this revision to Diff 217714.Wed, Aug 28, 1:35 PM
mstorsjo edited the summary of this revision. (Show Details)

Made the handling of the Data vector similar and consistent with StringTable, as patch [10/10] no longer needs doing it as I did before.

thakis accepted this revision.Thu, Aug 29, 1:31 PM

Nice!

llvm/include/llvm/Object/WindowsResource.h
192 ↗(On Diff #217714)

Maybe comment what StringIndex and DataIndex are?

This revision is now accepted and ready to land.Thu, Aug 29, 1:31 PM
This revision was automatically updated to reflect the committed changes.