[all-commits] [llvm/llvm-project] b989fc: [llvm-rc] Allow string table values split into mul...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Tue Aug 4 23:07:18 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b989fcbae6f179ad887d19ceef83ace1c00b87cc
      https://github.com/llvm/llvm-project/commit/b989fcbae6f179ad887d19ceef83ace1c00b87cc
  Author: Martin Storsjö <martin at martin.st>
  Date:   2020-08-05 (Wed, 05 Aug 2020)

  Changed paths:
    M llvm/test/tools/llvm-rc/Inputs/tag-stringtable-basic.rc
    M llvm/tools/llvm-rc/ResourceFileWriter.cpp
    M llvm/tools/llvm-rc/ResourceFileWriter.h
    M llvm/tools/llvm-rc/ResourceScriptParser.cpp
    M llvm/tools/llvm-rc/ResourceScriptStmt.cpp
    M llvm/tools/llvm-rc/ResourceScriptStmt.h

  Log Message:
  -----------
  [llvm-rc] Allow string table values split into multiple string literals

This can practically easily be a product of combining strings with
macros in resource files.

This fixes https://github.com/mstorsjo/llvm-mingw/issues/140.

As string literals within llvm-rc are handled as StringRefs, each
referencing an uninterpreted slice of the input file, with actual
interpretation of the input string (codepage handling, unescaping etc)
done only right before writing them out to disk, it's hard to
concatenate them other than just bundling them up in a vector,
without rearchitecting a large part of llvm-rc.

This matches how the same already is supported in VersionInfoValue,
with a std::vector<IntOrString> Values.

MS rc.exe only supports concatenated string literals in version info
values (already supported), string tables (implemented in this patch)
and user data resources (easily implemented in a separate patch, but
hasn't been requested by any end user yet), while GNU windres supports
string immediates split into multiple strings anywhere (e.g. like
(100 ICON "myicon" ".ico"). Not sure if concatenation in other
statements actually is used in the wild though, in resource files
normally built by GNU windres.

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




More information about the All-commits mailing list