summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-rc
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-rc')
-rw-r--r--llvm/tools/llvm-rc/ResourceFileWriter.cpp2
-rw-r--r--llvm/tools/llvm-rc/ResourceScriptParser.cpp45
-rw-r--r--llvm/tools/llvm-rc/ResourceScriptStmt.cpp13
-rw-r--r--llvm/tools/llvm-rc/ResourceScriptStmt.h5
4 files changed, 55 insertions, 10 deletions
diff --git a/llvm/tools/llvm-rc/ResourceFileWriter.cpp b/llvm/tools/llvm-rc/ResourceFileWriter.cpp
index 54f6c0ede73..b2cc2cc42f7 100644
--- a/llvm/tools/llvm-rc/ResourceFileWriter.cpp
+++ b/llvm/tools/llvm-rc/ResourceFileWriter.cpp
@@ -1016,7 +1016,7 @@ Error ResourceFileWriter::writeSingleDialogControl(const Control &Ctl,
}
// Window class - either 0xFFFF + 16-bit integer or a string.
- RETURN_IF_ERROR(writeIntOrString(IntOrString(TypeInfo.CtlClass)));
+ RETURN_IF_ERROR(writeIntOrString(Ctl.Class));
// Element caption/reference ID. ID is preceded by 0xFFFF.
RETURN_IF_ERROR(checkIntOrString(Ctl.Title, "Control reference ID"));
diff --git a/llvm/tools/llvm-rc/ResourceScriptParser.cpp b/llvm/tools/llvm-rc/ResourceScriptParser.cpp
index 7123df9029a..0319563e267 100644
--- a/llvm/tools/llvm-rc/ResourceScriptParser.cpp
+++ b/llvm/tools/llvm-rc/ResourceScriptParser.cpp
@@ -486,15 +486,46 @@ Expected<Control> RCParser::parseControl() {
Caption = *CaptionResult;
}
- ASSIGN_OR_RETURN(Args, readIntsWithCommas(5, 8));
+ ASSIGN_OR_RETURN(ID, readInt());
+ RETURN_IF_ERROR(consumeType(Kind::Comma));
- auto TakeOptArg = [&Args](size_t Id) -> Optional<uint32_t> {
- return Args->size() > Id ? (uint32_t)(*Args)[Id] : Optional<uint32_t>();
- };
+ IntOrString Class;
+ Optional<uint32_t> Style;
+ if (ClassUpper == "CONTROL") {
+ // CONTROL text, id, class, style, x, y, width, height [, exstyle] [, helpID]
+ ASSIGN_OR_RETURN(ClassStr, readString());
+ RETURN_IF_ERROR(consumeType(Kind::Comma));
+ Class = *ClassStr;
+ ASSIGN_OR_RETURN(StyleVal, readInt());
+ RETURN_IF_ERROR(consumeType(Kind::Comma));
+ Style = *StyleVal;
+ } else {
+ Class = CtlInfo->getValue().CtlClass;
+ }
+
+ // x, y, width, height
+ ASSIGN_OR_RETURN(Args, readIntsWithCommas(4, 4));
+
+ if (ClassUpper != "CONTROL") {
+ if (consumeOptionalType(Kind::Comma)) {
+ ASSIGN_OR_RETURN(Val, readInt());
+ Style = *Val;
+ }
+ }
+
+ Optional<uint32_t> ExStyle;
+ if (consumeOptionalType(Kind::Comma)) {
+ ASSIGN_OR_RETURN(Val, readInt());
+ ExStyle = *Val;
+ }
+ Optional<uint32_t> HelpID;
+ if (consumeOptionalType(Kind::Comma)) {
+ ASSIGN_OR_RETURN(Val, readInt());
+ HelpID = *Val;
+ }
- return Control(*ClassResult, Caption, (*Args)[0], (*Args)[1], (*Args)[2],
- (*Args)[3], (*Args)[4], TakeOptArg(5), TakeOptArg(6),
- TakeOptArg(7));
+ return Control(*ClassResult, Caption, *ID, (*Args)[0], (*Args)[1],
+ (*Args)[2], (*Args)[3], Style, ExStyle, HelpID, Class);
}
RCParser::ParseType RCParser::parseBitmapResource() {
diff --git a/llvm/tools/llvm-rc/ResourceScriptStmt.cpp b/llvm/tools/llvm-rc/ResourceScriptStmt.cpp
index 03742b5b350..86826bbf7b9 100644
--- a/llvm/tools/llvm-rc/ResourceScriptStmt.cpp
+++ b/llvm/tools/llvm-rc/ResourceScriptStmt.cpp
@@ -128,9 +128,22 @@ const StringMap<Control::CtlInfo> Control::SupportedCtls = {
{"LTEXT", CtlInfo{0x50020000, ClsStatic, true}},
{"CTEXT", CtlInfo{0x50020001, ClsStatic, true}},
{"RTEXT", CtlInfo{0x50020002, ClsStatic, true}},
+ {"ICON", CtlInfo{0x50000003, ClsStatic, true}},
{"PUSHBUTTON", CtlInfo{0x50010000, ClsButton, true}},
{"DEFPUSHBUTTON", CtlInfo{0x50010001, ClsButton, true}},
+ {"AUTO3STATE", CtlInfo{0x50010006, ClsButton, true}},
+ {"AUTOCHECKBOX", CtlInfo{0x50010003, ClsButton, true}},
+ {"AUTORADIOBUTTON", CtlInfo{0x50000009, ClsButton, true}},
+ {"CHECKBOX", CtlInfo{0x50010002, ClsButton, true}},
+ {"GROUPBOX", CtlInfo{0x50000007, ClsButton, true}},
+ {"RADIOBUTTON", CtlInfo{0x50000004, ClsButton, true}},
+ {"STATE3", CtlInfo{0x50010005, ClsButton, true}},
+ {"PUSHBOX", CtlInfo{0x5001000A, ClsButton, true}},
{"EDITTEXT", CtlInfo{0x50810000, ClsEdit, false}},
+ {"COMBOBOX", CtlInfo{0x50000000, ClsComboBox, false}},
+ {"LISTBOX", CtlInfo{0x50800001, ClsListBox, false}},
+ {"SCROLLBAR", CtlInfo{0x50000000, ClsScrollBar, false}},
+ {"CONTROL", CtlInfo{0x50000000, 0, true}},
};
raw_ostream &Control::log(raw_ostream &OS) const {
diff --git a/llvm/tools/llvm-rc/ResourceScriptStmt.h b/llvm/tools/llvm-rc/ResourceScriptStmt.h
index 485b7cab1d2..82f7d11aeb4 100644
--- a/llvm/tools/llvm-rc/ResourceScriptStmt.h
+++ b/llvm/tools/llvm-rc/ResourceScriptStmt.h
@@ -542,6 +542,7 @@ public:
IntOrString Title;
uint32_t ID, X, Y, Width, Height;
Optional<uint32_t> Style, ExtStyle, HelpID;
+ IntOrString Class;
// Control classes as described in DLGITEMTEMPLATEEX documentation.
//
@@ -565,10 +566,10 @@ public:
Control(StringRef CtlType, IntOrString CtlTitle, uint32_t CtlID,
uint32_t PosX, uint32_t PosY, uint32_t ItemWidth, uint32_t ItemHeight,
Optional<uint32_t> ItemStyle, Optional<uint32_t> ExtItemStyle,
- Optional<uint32_t> CtlHelpID)
+ Optional<uint32_t> CtlHelpID, IntOrString CtlClass)
: Type(CtlType), Title(CtlTitle), ID(CtlID), X(PosX), Y(PosY),
Width(ItemWidth), Height(ItemHeight), Style(ItemStyle),
- ExtStyle(ExtItemStyle), HelpID(CtlHelpID) {}
+ ExtStyle(ExtItemStyle), HelpID(CtlHelpID), Class(CtlClass) {}
static const StringMap<CtlInfo> SupportedCtls;
OpenPOWER on IntegriCloud