[llvm-rc] Serialize STRINGTABLE statements to .res file.

This allows llvm-rc to serialize STRINGTABLE resources.

These are output in an unusual way: we locate them at the end of the
file, and strings are merged into bundles of max 16 strings, depending
on their IDs, language, and characteristics.

Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381050.aspx

Patch by: Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D38420

llvm-svn: 315112
diff --git a/llvm/tools/llvm-rc/ResourceScriptStmt.h b/llvm/tools/llvm-rc/ResourceScriptStmt.h
index 2457d83..915d4f1 100644
--- a/llvm/tools/llvm-rc/ResourceScriptStmt.h
+++ b/llvm/tools/llvm-rc/ResourceScriptStmt.h
@@ -124,6 +124,7 @@
   RkSingleIcon = 3,
   RkMenu = 4,
   RkDialog = 5,
+  RkStringTableBundle = 6,
   RkAccelerators = 9,
   RkCursorGroup = 12,
   RkIconGroup = 14,
@@ -138,9 +139,10 @@
   RkBase,
   RkCursor,
   RkIcon,
+  RkStringTable,
   RkUser,
   RkSingleCursorOrIconRes,
-  RkCursorOrIconGroupRes
+  RkCursorOrIconGroupRes,
 };
 
 // Non-zero memory flags.
@@ -488,14 +490,18 @@
 //
 // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381050(v=vs.85).aspx
 class StringTableResource : public OptStatementsRCResource {
+public:
   std::vector<std::pair<uint32_t, StringRef>> Table;
 
-public:
   using OptStatementsRCResource::OptStatementsRCResource;
   void addString(uint32_t ID, StringRef String) {
     Table.emplace_back(ID, String);
   }
   raw_ostream &log(raw_ostream &) const override;
+  Twine getResourceTypeName() const override { return "STRINGTABLE"; }
+  Error visit(Visitor *V) const override {
+    return V->visitStringTableResource(this);
+  }
 };
 
 // -- DIALOG(EX) resource and its helper classes --