This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by mstorsjo on Aug 27 2019, 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.Aug 27 2019, 12:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2019, 12:11 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
mstorsjo updated this revision to Diff 217714.Aug 28 2019, 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.Aug 29 2019, 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.Aug 29 2019, 1:31 PM
This revision was automatically updated to reflect the committed changes.