[llvm-rc] Exclude padding from sizes in versioninfo resources
commit28719365d31ac5fedf4cdf60393f5ed05c002d9b
authorMartin Storsjo <martin@martin.st>
Mon, 7 May 2018 20:27:23 +0000 (7 20:27 +0000)
committerMartin Storsjo <martin@martin.st>
Mon, 7 May 2018 20:27:23 +0000 (7 20:27 +0000)
tree3aeac09e89166660728dc65dde8d7a67cb6526b2
parent63464d6d7f6907d5e4bb3b9354c8c36a926f5f2d
[llvm-rc] Exclude padding from sizes in versioninfo resources

Normally when writing something that requires padding, we first
measure the length of the written payload data, then write
padding if necessary.

For a recursive structure like versioninfo, this means that the
padding is excluded from the size of the inner element, but
included in the size of the enclosing block.

Rc.exe excludes the final padding (but not the padding of earlier
children) from all levels of the hierarchy.

To achieve this, don't pad after each block or value, but only
before starting the next one. We still pad after completing the
toplevel versioninfo resource, so this won't affect other resource
types.

Differential Revision: https://reviews.llvm.org/D46510

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331668 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-rc/Inputs/versioninfo-padding.rc [new file with mode: 0644]
test/tools/llvm-rc/versioninfo-padding.test [new file with mode: 0644]
tools/llvm-rc/ResourceFileWriter.cpp