diff options
author | Marek Sokolowski <mnbvmar@gmail.com> | 2017-09-30 00:38:52 +0000 |
---|---|---|
committer | Marek Sokolowski <mnbvmar@gmail.com> | 2017-09-30 00:38:52 +0000 |
commit | 7f7745c03815507ddda56914e25bdb0751333571 (patch) | |
tree | a8daf25fff429e336cfdace4bc4cdec28b53f6d2 /llvm/tools/llvm-rc/ResourceScriptParser.cpp | |
parent | 17d0bb9611beb3e170caf9e1f4462c041265724b (diff) | |
download | bcm5719-llvm-7f7745c03815507ddda56914e25bdb0751333571.tar.gz bcm5719-llvm-7f7745c03815507ddda56914e25bdb0751333571.zip |
[llvm-rc] Serialize DIALOG(EX) to .res files (serialization, pt 4).
This is now able to serialize DIALOG and DIALOGEX resources to .res
files. It still can't parse dialog-specific CAPTION, FONT, and STYLE
optional statement - these will be added in the following patch.
A limited set of controls is included. However, more can be easily added
by extending SupportedCtls map defined in ResourceScriptStmt.cpp.
Differential Revision: https://reviews.llvm.org/D37862
llvm-svn: 314578
Diffstat (limited to 'llvm/tools/llvm-rc/ResourceScriptParser.cpp')
-rw-r--r-- | llvm/tools/llvm-rc/ResourceScriptParser.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/tools/llvm-rc/ResourceScriptParser.cpp b/llvm/tools/llvm-rc/ResourceScriptParser.cpp index d4aa4b24379..1e32d4d1a9d 100644 --- a/llvm/tools/llvm-rc/ResourceScriptParser.cpp +++ b/llvm/tools/llvm-rc/ResourceScriptParser.cpp @@ -458,15 +458,17 @@ Expected<Control> RCParser::parseControl() { // [class] text, id, x, y, width, height [, style] [, exstyle] [, helpID] // [class] id, x, y, width, height [, style] [, exstyle] [, helpID] // Note that control ids must be integers. + // Text might be either a string or an integer pointing to resource ID. ASSIGN_OR_RETURN(ClassResult, readIdentifier()); std::string ClassUpper = ClassResult->upper(); - if (Control::SupportedCtls.find(ClassUpper) == Control::SupportedCtls.end()) + auto CtlInfo = Control::SupportedCtls.find(ClassUpper); + if (CtlInfo == Control::SupportedCtls.end()) return getExpectedError("control type, END or '}'", true); // Read caption if necessary. - StringRef Caption; - if (Control::CtlsWithTitle.find(ClassUpper) != Control::CtlsWithTitle.end()) { - ASSIGN_OR_RETURN(CaptionResult, readString()); + IntOrString Caption{StringRef()}; + if (CtlInfo->getValue().HasTitle) { + ASSIGN_OR_RETURN(CaptionResult, readIntOrString()); RETURN_IF_ERROR(consumeType(Kind::Comma)); Caption = *CaptionResult; } |