[llvm-rc] Add optional serialization support for DIALOG(EX) resources.

This is part 5 of llvm-rc serialization support.

This allows DIALOG and DIALOGEX to serialize if dialog-specific optional
statements are provided. These are (as of now): CAPTION, FONT, and
STYLE.

Notably, FONT statement can take more than two arguments when describing
DIALOGEX resources (as in
msdn.microsoft.com/en-us/library/windows/desktop/aa381013.aspx). I made
some changes to the parser to reflect this fact.

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

llvm-svn: 315104
diff --git a/llvm/tools/llvm-rc/ResourceScriptStmt.h b/llvm/tools/llvm-rc/ResourceScriptStmt.h
index 692d2ae..9082329 100644
--- a/llvm/tools/llvm-rc/ResourceScriptStmt.h
+++ b/llvm/tools/llvm-rc/ResourceScriptStmt.h
@@ -665,11 +665,13 @@
 //
 // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa380778(v=vs.85).aspx
 class CaptionStmt : public OptionalStmt {
+public:
   StringRef Value;
 
-public:
   CaptionStmt(StringRef Caption) : Value(Caption) {}
   raw_ostream &log(raw_ostream &) const override;
+  Twine getResourceTypeName() const override { return "CAPTION"; }
+  Error visit(Visitor *V) const override { return V->visitCaptionStmt(this); }
 };
 
 // FONT optional statement.
@@ -679,24 +681,31 @@
 //
 // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381013(v=vs.85).aspx
 class FontStmt : public OptionalStmt {
-  uint32_t Size;
-  StringRef Typeface;
-
 public:
-  FontStmt(uint32_t FontSize, StringRef FontName)
-      : Size(FontSize), Typeface(FontName) {}
+  uint32_t Size, Weight, Charset;
+  StringRef Name;
+  bool Italic;
+
+  FontStmt(uint32_t FontSize, StringRef FontName, uint32_t FontWeight,
+           bool FontItalic, uint32_t FontCharset)
+      : Size(FontSize), Weight(FontWeight), Charset(FontCharset),
+        Name(FontName), Italic(FontItalic) {}
   raw_ostream &log(raw_ostream &) const override;
+  Twine getResourceTypeName() const override { return "FONT"; }
+  Error visit(Visitor *V) const override { return V->visitFontStmt(this); }
 };
 
 // STYLE optional statement.
 //
 // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381051(v=vs.85).aspx
 class StyleStmt : public OptionalStmt {
+public:
   uint32_t Value;
 
-public:
   StyleStmt(uint32_t Style) : Value(Style) {}
   raw_ostream &log(raw_ostream &) const override;
+  Twine getResourceTypeName() const override { return "STYLE"; }
+  Error visit(Visitor *V) const override { return V->visitStyleStmt(this); }
 };
 
 } // namespace rc