Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 1 | //===-- ResourceScriptStmt.h ------------------------------------*- C++-*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===---------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This lists all the resource and statement types occurring in RC scripts. |
| 11 | // |
| 12 | //===---------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_TOOLS_LLVMRC_RESOURCESCRIPTSTMT_H |
| 15 | #define LLVM_TOOLS_LLVMRC_RESOURCESCRIPTSTMT_H |
| 16 | |
| 17 | #include "ResourceScriptToken.h" |
Marek Sokolowski | 8f19343 | 2017-09-29 17:14:09 +0000 | [diff] [blame] | 18 | #include "ResourceVisitor.h" |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 19 | |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 20 | #include "llvm/ADT/StringSet.h" |
| 21 | |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 22 | namespace llvm { |
| 23 | namespace rc { |
| 24 | |
| 25 | // A class holding a name - either an integer or a reference to the string. |
| 26 | class IntOrString { |
| 27 | private: |
| 28 | union Data { |
| 29 | uint32_t Int; |
| 30 | StringRef String; |
| 31 | Data(uint32_t Value) : Int(Value) {} |
| 32 | Data(const StringRef Value) : String(Value) {} |
Marek Sokolowski | 7f11052 | 2017-08-28 22:58:31 +0000 | [diff] [blame] | 33 | Data(const RCToken &Token) { |
| 34 | if (Token.kind() == RCToken::Kind::Int) |
| 35 | Int = Token.intValue(); |
| 36 | else |
| 37 | String = Token.value(); |
| 38 | } |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 39 | } Data; |
| 40 | bool IsInt; |
| 41 | |
| 42 | public: |
| 43 | IntOrString() : IntOrString(0) {} |
| 44 | IntOrString(uint32_t Value) : Data(Value), IsInt(1) {} |
| 45 | IntOrString(StringRef Value) : Data(Value), IsInt(0) {} |
| 46 | IntOrString(const RCToken &Token) |
| 47 | : Data(Token), IsInt(Token.kind() == RCToken::Kind::Int) {} |
| 48 | |
| 49 | bool equalsLower(const char *Str) { |
| 50 | return !IsInt && Data.String.equals_lower(Str); |
| 51 | } |
| 52 | |
Marek Sokolowski | 8f19343 | 2017-09-29 17:14:09 +0000 | [diff] [blame] | 53 | bool isInt() const { return IsInt; } |
| 54 | |
| 55 | uint32_t getInt() const { |
| 56 | assert(IsInt); |
| 57 | return Data.Int; |
| 58 | } |
| 59 | |
| 60 | const StringRef &getString() const { |
| 61 | assert(!IsInt); |
| 62 | return Data.String; |
| 63 | } |
| 64 | |
| 65 | operator Twine() const { |
| 66 | return isInt() ? Twine(getInt()) : Twine(getString()); |
| 67 | } |
| 68 | |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 69 | friend raw_ostream &operator<<(raw_ostream &, const IntOrString &); |
| 70 | }; |
| 71 | |
Marek Sokolowski | 8f19343 | 2017-09-29 17:14:09 +0000 | [diff] [blame] | 72 | enum ResourceKind { |
| 73 | // These resource kinds have corresponding .res resource type IDs |
| 74 | // (TYPE in RESOURCEHEADER structure). The numeric value assigned to each |
| 75 | // kind is equal to this type ID. |
| 76 | RkNull = 0, |
| 77 | RkMenu = 4, |
| 78 | RkDialog = 5, |
| 79 | RkAccelerators = 9, |
| 80 | RkVersionInfo = 16, |
| 81 | RkHTML = 23, |
| 82 | |
| 83 | // These kinds don't have assigned type IDs (they might be the resources |
| 84 | // of invalid kind, expand to many resource structures in .res files, |
| 85 | // or have variable type ID). In order to avoid ID clashes with IDs above, |
| 86 | // we assign the kinds the values 256 and larger. |
| 87 | RkInvalid = 256, |
| 88 | RkBase, |
| 89 | RkCursor, |
| 90 | RkIcon, |
| 91 | RkUser |
| 92 | }; |
| 93 | |
| 94 | // Non-zero memory flags. |
| 95 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/ms648027(v=vs.85).aspx |
| 96 | enum MemoryFlags { |
| 97 | MfMoveable = 0x10, |
| 98 | MfPure = 0x20, |
| 99 | MfPreload = 0x40, |
| 100 | MfDiscardable = 0x1000 |
| 101 | }; |
| 102 | |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 103 | // Base resource. All the resources should derive from this base. |
| 104 | class RCResource { |
Marek Sokolowski | 8f19343 | 2017-09-29 17:14:09 +0000 | [diff] [blame] | 105 | public: |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 106 | IntOrString ResName; |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 107 | void setName(const IntOrString &Name) { ResName = Name; } |
| 108 | virtual raw_ostream &log(raw_ostream &OS) const { |
| 109 | return OS << "Base statement\n"; |
| 110 | }; |
| 111 | virtual ~RCResource() {} |
Marek Sokolowski | 8f19343 | 2017-09-29 17:14:09 +0000 | [diff] [blame] | 112 | |
| 113 | virtual Error visit(Visitor *) const { |
| 114 | llvm_unreachable("This is unable to call methods from Visitor base"); |
| 115 | } |
| 116 | |
Marek Sokolowski | 22fccd6 | 2017-09-29 19:07:44 +0000 | [diff] [blame] | 117 | // Apply the statements attached to this resource. Generic resources |
| 118 | // don't have any. |
| 119 | virtual Error applyStmts(Visitor *) const { return Error::success(); } |
| 120 | |
Marek Sokolowski | 8f19343 | 2017-09-29 17:14:09 +0000 | [diff] [blame] | 121 | // By default, memory flags are DISCARDABLE | PURE | MOVEABLE. |
| 122 | virtual uint16_t getMemoryFlags() const { |
| 123 | return MfDiscardable | MfPure | MfMoveable; |
| 124 | } |
| 125 | virtual ResourceKind getKind() const { return RkBase; } |
| 126 | static bool classof(const RCResource *Res) { return true; } |
| 127 | |
| 128 | virtual IntOrString getResourceType() const { |
| 129 | llvm_unreachable("This cannot be called on objects without types."); |
| 130 | } |
| 131 | virtual Twine getResourceTypeName() const { |
| 132 | llvm_unreachable("This cannot be called on objects without types."); |
| 133 | }; |
| 134 | }; |
| 135 | |
| 136 | // An empty resource. It has no content, type 0, ID 0 and all of its |
| 137 | // characteristics are equal to 0. |
| 138 | class NullResource : public RCResource { |
| 139 | public: |
| 140 | raw_ostream &log(raw_ostream &OS) const override { |
| 141 | return OS << "Null resource\n"; |
| 142 | } |
| 143 | Error visit(Visitor *V) const override { return V->visitNullResource(this); } |
| 144 | IntOrString getResourceType() const override { return 0; } |
| 145 | Twine getResourceTypeName() const override { return "(NULL)"; } |
| 146 | uint16_t getMemoryFlags() const override { return 0; } |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 147 | }; |
| 148 | |
| 149 | // Optional statement base. All such statements should derive from this base. |
| 150 | class OptionalStmt : public RCResource {}; |
| 151 | |
| 152 | class OptionalStmtList : public OptionalStmt { |
| 153 | std::vector<std::unique_ptr<OptionalStmt>> Statements; |
| 154 | |
| 155 | public: |
| 156 | OptionalStmtList() {} |
Marek Sokolowski | 22fccd6 | 2017-09-29 19:07:44 +0000 | [diff] [blame] | 157 | raw_ostream &log(raw_ostream &OS) const override; |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 158 | |
| 159 | void addStmt(std::unique_ptr<OptionalStmt> Stmt) { |
| 160 | Statements.push_back(std::move(Stmt)); |
| 161 | } |
Marek Sokolowski | 22fccd6 | 2017-09-29 19:07:44 +0000 | [diff] [blame] | 162 | |
| 163 | Error visit(Visitor *V) const override { |
| 164 | for (auto &StmtPtr : Statements) |
| 165 | if (auto Err = StmtPtr->visit(V)) |
| 166 | return Err; |
| 167 | return Error::success(); |
| 168 | } |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 169 | }; |
| 170 | |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 171 | class OptStatementsRCResource : public RCResource { |
| 172 | public: |
| 173 | std::unique_ptr<OptionalStmtList> OptStatements; |
| 174 | |
| 175 | OptStatementsRCResource(OptionalStmtList &&Stmts) |
| 176 | : OptStatements(llvm::make_unique<OptionalStmtList>(std::move(Stmts))) {} |
Marek Sokolowski | 22fccd6 | 2017-09-29 19:07:44 +0000 | [diff] [blame] | 177 | |
| 178 | virtual Error applyStmts(Visitor *V) const { return OptStatements->visit(V); } |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 179 | }; |
| 180 | |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 181 | // LANGUAGE statement. It can occur both as a top-level statement (in such |
| 182 | // a situation, it changes the default language until the end of the file) |
| 183 | // and as an optional resource statement (then it changes the language |
| 184 | // of a single resource). |
| 185 | // |
| 186 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381019(v=vs.85).aspx |
| 187 | class LanguageResource : public OptionalStmt { |
Marek Sokolowski | 8f19343 | 2017-09-29 17:14:09 +0000 | [diff] [blame] | 188 | public: |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 189 | uint32_t Lang, SubLang; |
| 190 | |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 191 | LanguageResource(uint32_t LangId, uint32_t SubLangId) |
| 192 | : Lang(LangId), SubLang(SubLangId) {} |
| 193 | raw_ostream &log(raw_ostream &) const override; |
Marek Sokolowski | 8f19343 | 2017-09-29 17:14:09 +0000 | [diff] [blame] | 194 | |
| 195 | // This is not a regular top-level statement; when it occurs, it just |
| 196 | // modifies the language context. |
| 197 | Error visit(Visitor *V) const override { return V->visitLanguageStmt(this); } |
| 198 | Twine getResourceTypeName() const override { return "LANGUAGE"; } |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 199 | }; |
| 200 | |
Marek Sokolowski | 7f11052 | 2017-08-28 22:58:31 +0000 | [diff] [blame] | 201 | // ACCELERATORS resource. Defines a named table of accelerators for the app. |
| 202 | // |
| 203 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa380610(v=vs.85).aspx |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 204 | class AcceleratorsResource : public OptStatementsRCResource { |
Marek Sokolowski | 7f11052 | 2017-08-28 22:58:31 +0000 | [diff] [blame] | 205 | public: |
| 206 | class Accelerator { |
| 207 | public: |
| 208 | IntOrString Event; |
| 209 | uint32_t Id; |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 210 | uint16_t Flags; |
Marek Sokolowski | 7f11052 | 2017-08-28 22:58:31 +0000 | [diff] [blame] | 211 | |
| 212 | enum Options { |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 213 | // This is actually 0x0000 (accelerator is assumed to be ASCII if it's |
| 214 | // not VIRTKEY). However, rc.exe behavior is different in situations |
| 215 | // "only ASCII defined" and "neither ASCII nor VIRTKEY defined". |
| 216 | // Therefore, we include ASCII as another flag. This must be zeroed |
| 217 | // when serialized. |
| 218 | ASCII = 0x8000, |
| 219 | VIRTKEY = 0x0001, |
| 220 | NOINVERT = 0x0002, |
| 221 | ALT = 0x0010, |
| 222 | SHIFT = 0x0004, |
| 223 | CONTROL = 0x0008 |
Marek Sokolowski | 7f11052 | 2017-08-28 22:58:31 +0000 | [diff] [blame] | 224 | }; |
| 225 | |
| 226 | static constexpr size_t NumFlags = 6; |
| 227 | static StringRef OptionsStr[NumFlags]; |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 228 | static uint32_t OptionsFlags[NumFlags]; |
Marek Sokolowski | 7f11052 | 2017-08-28 22:58:31 +0000 | [diff] [blame] | 229 | }; |
| 230 | |
Marek Sokolowski | 22fccd6 | 2017-09-29 19:07:44 +0000 | [diff] [blame] | 231 | std::vector<Accelerator> Accelerators; |
| 232 | |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 233 | using OptStatementsRCResource::OptStatementsRCResource; |
| 234 | void addAccelerator(IntOrString Event, uint32_t Id, uint16_t Flags) { |
Marek Sokolowski | 7f11052 | 2017-08-28 22:58:31 +0000 | [diff] [blame] | 235 | Accelerators.push_back(Accelerator{Event, Id, Flags}); |
| 236 | } |
| 237 | raw_ostream &log(raw_ostream &) const override; |
| 238 | |
Marek Sokolowski | 22fccd6 | 2017-09-29 19:07:44 +0000 | [diff] [blame] | 239 | IntOrString getResourceType() const override { return RkAccelerators; } |
| 240 | uint16_t getMemoryFlags() const override { |
| 241 | return MfPure | MfMoveable; |
| 242 | } |
| 243 | Twine getResourceTypeName() const override { return "ACCELERATORS"; } |
| 244 | |
| 245 | Error visit(Visitor *V) const override { |
| 246 | return V->visitAcceleratorsResource(this); |
| 247 | } |
| 248 | ResourceKind getKind() const override { return RkAccelerators; } |
| 249 | static bool classof(const RCResource *Res) { |
| 250 | return Res->getKind() == RkAccelerators; |
| 251 | } |
Marek Sokolowski | 7f11052 | 2017-08-28 22:58:31 +0000 | [diff] [blame] | 252 | }; |
| 253 | |
Marek Sokolowski | 72aa937 | 2017-08-28 21:59:54 +0000 | [diff] [blame] | 254 | // CURSOR resource. Represents a single cursor (".cur") file. |
| 255 | // |
| 256 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa380920(v=vs.85).aspx |
| 257 | class CursorResource : public RCResource { |
| 258 | StringRef CursorLoc; |
| 259 | |
| 260 | public: |
| 261 | CursorResource(StringRef Location) : CursorLoc(Location) {} |
| 262 | raw_ostream &log(raw_ostream &) const override; |
| 263 | }; |
| 264 | |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 265 | // ICON resource. Represents a single ".ico" file containing a group of icons. |
| 266 | // |
| 267 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381018(v=vs.85).aspx |
| 268 | class IconResource : public RCResource { |
| 269 | StringRef IconLoc; |
| 270 | |
| 271 | public: |
| 272 | IconResource(StringRef Location) : IconLoc(Location) {} |
| 273 | raw_ostream &log(raw_ostream &) const override; |
| 274 | }; |
| 275 | |
Marek Sokolowski | 72aa937 | 2017-08-28 21:59:54 +0000 | [diff] [blame] | 276 | // HTML resource. Represents a local webpage that is to be embedded into the |
| 277 | // resulting resource file. It embeds a file only - no additional resources |
| 278 | // (images etc.) are included with this resource. |
| 279 | // |
| 280 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa966018(v=vs.85).aspx |
| 281 | class HTMLResource : public RCResource { |
Marek Sokolowski | 8f19343 | 2017-09-29 17:14:09 +0000 | [diff] [blame] | 282 | public: |
Marek Sokolowski | 72aa937 | 2017-08-28 21:59:54 +0000 | [diff] [blame] | 283 | StringRef HTMLLoc; |
| 284 | |
Marek Sokolowski | 72aa937 | 2017-08-28 21:59:54 +0000 | [diff] [blame] | 285 | HTMLResource(StringRef Location) : HTMLLoc(Location) {} |
| 286 | raw_ostream &log(raw_ostream &) const override; |
Marek Sokolowski | 8f19343 | 2017-09-29 17:14:09 +0000 | [diff] [blame] | 287 | |
| 288 | Error visit(Visitor *V) const override { return V->visitHTMLResource(this); } |
| 289 | |
| 290 | // Curiously, file resources don't have DISCARDABLE flag set. |
| 291 | uint16_t getMemoryFlags() const override { return MfPure | MfMoveable; } |
| 292 | IntOrString getResourceType() const override { return RkHTML; } |
| 293 | Twine getResourceTypeName() const override { return "HTML"; } |
| 294 | ResourceKind getKind() const override { return RkHTML; } |
| 295 | static bool classof(const RCResource *Res) { |
| 296 | return Res->getKind() == RkHTML; |
| 297 | } |
Marek Sokolowski | 72aa937 | 2017-08-28 21:59:54 +0000 | [diff] [blame] | 298 | }; |
| 299 | |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 300 | // -- MENU resource and its helper classes -- |
| 301 | // This resource describes the contents of an application menu |
| 302 | // (usually located in the upper part of the dialog.) |
| 303 | // |
| 304 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381025(v=vs.85).aspx |
| 305 | |
| 306 | // Description of a single submenu item. |
| 307 | class MenuDefinition { |
| 308 | public: |
| 309 | enum Options { |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 310 | CHECKED = 0x0008, |
| 311 | GRAYED = 0x0001, |
| 312 | HELP = 0x4000, |
| 313 | INACTIVE = 0x0002, |
| 314 | MENUBARBREAK = 0x0020, |
| 315 | MENUBREAK = 0x0040 |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 316 | }; |
| 317 | |
Marek Sokolowski | 42f494d | 2017-09-29 22:25:05 +0000 | [diff] [blame] | 318 | enum MenuDefKind { MkBase, MkSeparator, MkMenuItem, MkPopup }; |
| 319 | |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 320 | static constexpr size_t NumFlags = 6; |
| 321 | static StringRef OptionsStr[NumFlags]; |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 322 | static uint32_t OptionsFlags[NumFlags]; |
| 323 | static raw_ostream &logFlags(raw_ostream &, uint16_t Flags); |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 324 | virtual raw_ostream &log(raw_ostream &OS) const { |
| 325 | return OS << "Base menu definition\n"; |
| 326 | } |
| 327 | virtual ~MenuDefinition() {} |
Marek Sokolowski | 42f494d | 2017-09-29 22:25:05 +0000 | [diff] [blame] | 328 | |
| 329 | virtual uint16_t getResFlags() const { return 0; } |
| 330 | virtual MenuDefKind getKind() const { return MkBase; } |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 331 | }; |
| 332 | |
| 333 | // Recursive description of a whole submenu. |
| 334 | class MenuDefinitionList : public MenuDefinition { |
Marek Sokolowski | 42f494d | 2017-09-29 22:25:05 +0000 | [diff] [blame] | 335 | public: |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 336 | std::vector<std::unique_ptr<MenuDefinition>> Definitions; |
| 337 | |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 338 | void addDefinition(std::unique_ptr<MenuDefinition> Def) { |
| 339 | Definitions.push_back(std::move(Def)); |
| 340 | } |
| 341 | raw_ostream &log(raw_ostream &) const override; |
| 342 | }; |
| 343 | |
| 344 | // Separator in MENU definition (MENUITEM SEPARATOR). |
| 345 | // |
| 346 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381024(v=vs.85).aspx |
| 347 | class MenuSeparator : public MenuDefinition { |
| 348 | public: |
| 349 | raw_ostream &log(raw_ostream &) const override; |
Marek Sokolowski | 42f494d | 2017-09-29 22:25:05 +0000 | [diff] [blame] | 350 | |
| 351 | MenuDefKind getKind() const override { return MkSeparator; } |
| 352 | static bool classof(const MenuDefinition *D) { |
| 353 | return D->getKind() == MkSeparator; |
| 354 | } |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 355 | }; |
| 356 | |
| 357 | // MENUITEM statement definition. |
| 358 | // |
| 359 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381024(v=vs.85).aspx |
| 360 | class MenuItem : public MenuDefinition { |
Marek Sokolowski | 42f494d | 2017-09-29 22:25:05 +0000 | [diff] [blame] | 361 | public: |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 362 | StringRef Name; |
| 363 | uint32_t Id; |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 364 | uint16_t Flags; |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 365 | |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 366 | MenuItem(StringRef Caption, uint32_t ItemId, uint16_t ItemFlags) |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 367 | : Name(Caption), Id(ItemId), Flags(ItemFlags) {} |
| 368 | raw_ostream &log(raw_ostream &) const override; |
Marek Sokolowski | 42f494d | 2017-09-29 22:25:05 +0000 | [diff] [blame] | 369 | |
| 370 | uint16_t getResFlags() const override { return Flags; } |
| 371 | MenuDefKind getKind() const override { return MkMenuItem; } |
| 372 | static bool classof(const MenuDefinition *D) { |
| 373 | return D->getKind() == MkMenuItem; |
| 374 | } |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 375 | }; |
| 376 | |
| 377 | // POPUP statement definition. |
| 378 | // |
| 379 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381030(v=vs.85).aspx |
| 380 | class PopupItem : public MenuDefinition { |
Marek Sokolowski | 42f494d | 2017-09-29 22:25:05 +0000 | [diff] [blame] | 381 | public: |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 382 | StringRef Name; |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 383 | uint16_t Flags; |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 384 | MenuDefinitionList SubItems; |
| 385 | |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 386 | PopupItem(StringRef Caption, uint16_t ItemFlags, |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 387 | MenuDefinitionList &&SubItemsList) |
| 388 | : Name(Caption), Flags(ItemFlags), SubItems(std::move(SubItemsList)) {} |
| 389 | raw_ostream &log(raw_ostream &) const override; |
Marek Sokolowski | 42f494d | 2017-09-29 22:25:05 +0000 | [diff] [blame] | 390 | |
| 391 | // This has an additional (0x10) flag. It doesn't match with documented |
| 392 | // 0x01 flag, though. |
| 393 | uint16_t getResFlags() const override { return Flags | 0x10; } |
| 394 | MenuDefKind getKind() const override { return MkPopup; } |
| 395 | static bool classof(const MenuDefinition *D) { |
| 396 | return D->getKind() == MkPopup; |
| 397 | } |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 398 | }; |
| 399 | |
| 400 | // Menu resource definition. |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 401 | class MenuResource : public OptStatementsRCResource { |
Marek Sokolowski | 42f494d | 2017-09-29 22:25:05 +0000 | [diff] [blame] | 402 | public: |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 403 | MenuDefinitionList Elements; |
| 404 | |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 405 | MenuResource(OptionalStmtList &&OptStmts, MenuDefinitionList &&Items) |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 406 | : OptStatementsRCResource(std::move(OptStmts)), |
| 407 | Elements(std::move(Items)) {} |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 408 | raw_ostream &log(raw_ostream &) const override; |
Marek Sokolowski | 42f494d | 2017-09-29 22:25:05 +0000 | [diff] [blame] | 409 | |
| 410 | IntOrString getResourceType() const override { return RkMenu; } |
| 411 | Twine getResourceTypeName() const override { return "MENU"; } |
| 412 | Error visit(Visitor *V) const override { return V->visitMenuResource(this); } |
| 413 | ResourceKind getKind() const override { return RkMenu; } |
| 414 | static bool classof(const RCResource *Res) { |
| 415 | return Res->getKind() == RkMenu; |
| 416 | } |
Marek Sokolowski | 99ecb0e | 2017-08-28 23:46:30 +0000 | [diff] [blame] | 417 | }; |
| 418 | |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 419 | // STRINGTABLE resource. Contains a list of strings, each having its unique ID. |
| 420 | // |
| 421 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381050(v=vs.85).aspx |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 422 | class StringTableResource : public OptStatementsRCResource { |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 423 | std::vector<std::pair<uint32_t, StringRef>> Table; |
| 424 | |
| 425 | public: |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 426 | using OptStatementsRCResource::OptStatementsRCResource; |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 427 | void addString(uint32_t ID, StringRef String) { |
| 428 | Table.emplace_back(ID, String); |
| 429 | } |
| 430 | raw_ostream &log(raw_ostream &) const override; |
| 431 | }; |
| 432 | |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 433 | // -- DIALOG(EX) resource and its helper classes -- |
| 434 | // |
| 435 | // This resource describes dialog boxes and controls residing inside them. |
| 436 | // |
| 437 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381003(v=vs.85).aspx |
| 438 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381002(v=vs.85).aspx |
| 439 | |
| 440 | // Single control definition. |
| 441 | class Control { |
Marek Sokolowski | 7f7745c | 2017-09-30 00:38:52 +0000 | [diff] [blame] | 442 | public: |
| 443 | StringRef Type; |
| 444 | IntOrString Title; |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 445 | uint32_t ID, X, Y, Width, Height; |
| 446 | Optional<uint32_t> Style, ExtStyle, HelpID; |
| 447 | |
Marek Sokolowski | 7f7745c | 2017-09-30 00:38:52 +0000 | [diff] [blame] | 448 | // Control classes as described in DLGITEMTEMPLATEEX documentation. |
| 449 | // |
| 450 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/ms645389.aspx |
| 451 | enum CtlClasses { |
| 452 | ClsButton = 0x80, |
| 453 | ClsEdit = 0x81, |
| 454 | ClsStatic = 0x82, |
| 455 | ClsListBox = 0x83, |
| 456 | ClsScrollBar = 0x84, |
| 457 | ClsComboBox = 0x85 |
| 458 | }; |
| 459 | |
| 460 | // Simple information about a single control type. |
| 461 | struct CtlInfo { |
| 462 | uint32_t Style; |
| 463 | uint16_t CtlClass; |
| 464 | bool HasTitle; |
| 465 | }; |
| 466 | |
| 467 | Control(StringRef CtlType, IntOrString CtlTitle, uint32_t CtlID, |
| 468 | uint32_t PosX, uint32_t PosY, uint32_t ItemWidth, uint32_t ItemHeight, |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 469 | Optional<uint32_t> ItemStyle, Optional<uint32_t> ExtItemStyle, |
| 470 | Optional<uint32_t> CtlHelpID) |
| 471 | : Type(CtlType), Title(CtlTitle), ID(CtlID), X(PosX), Y(PosY), |
| 472 | Width(ItemWidth), Height(ItemHeight), Style(ItemStyle), |
| 473 | ExtStyle(ExtItemStyle), HelpID(CtlHelpID) {} |
| 474 | |
Marek Sokolowski | 7f7745c | 2017-09-30 00:38:52 +0000 | [diff] [blame] | 475 | static const StringMap<CtlInfo> SupportedCtls; |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 476 | |
| 477 | raw_ostream &log(raw_ostream &) const; |
| 478 | }; |
| 479 | |
| 480 | // Single dialog definition. We don't create distinct classes for DIALOG and |
| 481 | // DIALOGEX because of their being too similar to each other. We only have a |
| 482 | // flag determining the type of the dialog box. |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 483 | class DialogResource : public OptStatementsRCResource { |
Marek Sokolowski | 7f7745c | 2017-09-30 00:38:52 +0000 | [diff] [blame] | 484 | public: |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 485 | uint32_t X, Y, Width, Height, HelpID; |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 486 | std::vector<Control> Controls; |
| 487 | bool IsExtended; |
| 488 | |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 489 | DialogResource(uint32_t PosX, uint32_t PosY, uint32_t DlgWidth, |
| 490 | uint32_t DlgHeight, uint32_t DlgHelpID, |
| 491 | OptionalStmtList &&OptStmts, bool IsDialogEx) |
Marek Sokolowski | c75a087 | 2017-09-29 17:46:32 +0000 | [diff] [blame] | 492 | : OptStatementsRCResource(std::move(OptStmts)), X(PosX), Y(PosY), |
| 493 | Width(DlgWidth), Height(DlgHeight), HelpID(DlgHelpID), |
| 494 | IsExtended(IsDialogEx) {} |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 495 | |
| 496 | void addControl(Control &&Ctl) { Controls.push_back(std::move(Ctl)); } |
| 497 | |
| 498 | raw_ostream &log(raw_ostream &) const override; |
Marek Sokolowski | 7f7745c | 2017-09-30 00:38:52 +0000 | [diff] [blame] | 499 | |
| 500 | // It was a weird design decision to assign the same resource type number |
| 501 | // both for DIALOG and DIALOGEX (and the same structure version number). |
| 502 | // It makes it possible for DIALOG to be mistaken for DIALOGEX. |
| 503 | IntOrString getResourceType() const override { return RkDialog; } |
| 504 | Twine getResourceTypeName() const override { |
| 505 | return "DIALOG" + Twine(IsExtended ? "EX" : ""); |
| 506 | } |
| 507 | Error visit(Visitor *V) const override { |
| 508 | return V->visitDialogResource(this); |
| 509 | } |
| 510 | ResourceKind getKind() const override { return RkDialog; } |
| 511 | static bool classof(const RCResource *Res) { |
| 512 | return Res->getKind() == RkDialog; |
| 513 | } |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 514 | }; |
| 515 | |
Marek Sokolowski | b5f39a0 | 2017-09-29 00:14:18 +0000 | [diff] [blame] | 516 | // User-defined resource. It is either: |
| 517 | // * a link to the file, e.g. NAME TYPE "filename", |
| 518 | // * or contains a list of integers and strings, e.g. NAME TYPE {1, "a", 2}. |
| 519 | class UserDefinedResource : public RCResource { |
| 520 | IntOrString Type; |
| 521 | StringRef FileLoc; |
| 522 | std::vector<IntOrString> Contents; |
| 523 | bool IsFileResource; |
| 524 | |
| 525 | public: |
| 526 | UserDefinedResource(IntOrString ResourceType, StringRef FileLocation) |
| 527 | : Type(ResourceType), FileLoc(FileLocation), IsFileResource(true) {} |
| 528 | UserDefinedResource(IntOrString ResourceType, std::vector<IntOrString> &&Data) |
| 529 | : Type(ResourceType), Contents(std::move(Data)), IsFileResource(false) {} |
| 530 | |
| 531 | raw_ostream &log(raw_ostream &) const override; |
| 532 | }; |
| 533 | |
Marek Sokolowski | fb74cb1 | 2017-09-28 22:41:38 +0000 | [diff] [blame] | 534 | // -- VERSIONINFO resource and its helper classes -- |
| 535 | // |
| 536 | // This resource lists the version information on the executable/library. |
| 537 | // The declaration consists of the following items: |
| 538 | // * A number of fixed optional version statements (e.g. FILEVERSION, FILEOS) |
| 539 | // * BEGIN |
| 540 | // * A number of BLOCK and/or VALUE statements. BLOCK recursively defines |
| 541 | // another block of version information, whereas VALUE defines a |
| 542 | // key -> value correspondence. There might be more than one value |
| 543 | // corresponding to the single key. |
| 544 | // * END |
| 545 | // |
| 546 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381058(v=vs.85).aspx |
| 547 | |
| 548 | // A single VERSIONINFO statement; |
| 549 | class VersionInfoStmt { |
| 550 | public: |
| 551 | virtual raw_ostream &log(raw_ostream &OS) const { return OS << "VI stmt\n"; } |
| 552 | virtual ~VersionInfoStmt() {} |
| 553 | }; |
| 554 | |
| 555 | // BLOCK definition; also the main VERSIONINFO declaration is considered a |
| 556 | // BLOCK, although it has no name. |
| 557 | // The correct top-level blocks are "VarFileInfo" and "StringFileInfo". We don't |
| 558 | // care about them at the parsing phase. |
| 559 | class VersionInfoBlock : public VersionInfoStmt { |
| 560 | std::vector<std::unique_ptr<VersionInfoStmt>> Stmts; |
| 561 | StringRef Name; |
| 562 | |
| 563 | public: |
| 564 | VersionInfoBlock(StringRef BlockName) : Name(BlockName) {} |
| 565 | void addStmt(std::unique_ptr<VersionInfoStmt> Stmt) { |
| 566 | Stmts.push_back(std::move(Stmt)); |
| 567 | } |
| 568 | raw_ostream &log(raw_ostream &) const override; |
| 569 | }; |
| 570 | |
| 571 | class VersionInfoValue : public VersionInfoStmt { |
| 572 | StringRef Key; |
| 573 | std::vector<IntOrString> Values; |
| 574 | |
| 575 | public: |
| 576 | VersionInfoValue(StringRef InfoKey, std::vector<IntOrString> &&Vals) |
| 577 | : Key(InfoKey), Values(std::move(Vals)) {} |
| 578 | raw_ostream &log(raw_ostream &) const override; |
| 579 | }; |
| 580 | |
| 581 | class VersionInfoResource : public RCResource { |
| 582 | public: |
| 583 | // A class listing fixed VERSIONINFO statements (occuring before main BEGIN). |
| 584 | // If any of these is not specified, it is assumed by the original tool to |
| 585 | // be equal to 0. |
| 586 | class VersionInfoFixed { |
| 587 | public: |
| 588 | enum VersionInfoFixedType { |
| 589 | FtUnknown, |
| 590 | FtFileVersion, |
| 591 | FtProductVersion, |
| 592 | FtFileFlagsMask, |
| 593 | FtFileFlags, |
| 594 | FtFileOS, |
| 595 | FtFileType, |
| 596 | FtFileSubtype, |
| 597 | FtNumTypes |
| 598 | }; |
| 599 | |
| 600 | private: |
| 601 | static const StringMap<VersionInfoFixedType> FixedFieldsInfoMap; |
| 602 | static const StringRef FixedFieldsNames[FtNumTypes]; |
| 603 | |
| 604 | public: |
| 605 | SmallVector<uint32_t, 4> FixedInfo[FtNumTypes]; |
| 606 | SmallVector<bool, FtNumTypes> IsTypePresent; |
| 607 | |
| 608 | static VersionInfoFixedType getFixedType(StringRef Type); |
| 609 | static bool isTypeSupported(VersionInfoFixedType Type); |
| 610 | static bool isVersionType(VersionInfoFixedType Type); |
| 611 | |
| 612 | VersionInfoFixed() : IsTypePresent(FtNumTypes, false) {} |
| 613 | |
| 614 | void setValue(VersionInfoFixedType Type, ArrayRef<uint32_t> Value) { |
| 615 | FixedInfo[Type] = SmallVector<uint32_t, 4>(Value.begin(), Value.end()); |
| 616 | IsTypePresent[Type] = true; |
| 617 | } |
| 618 | |
| 619 | raw_ostream &log(raw_ostream &) const; |
| 620 | }; |
| 621 | |
| 622 | private: |
| 623 | VersionInfoBlock MainBlock; |
| 624 | VersionInfoFixed FixedData; |
| 625 | |
| 626 | public: |
| 627 | VersionInfoResource(VersionInfoBlock &&TopLevelBlock, |
| 628 | VersionInfoFixed &&FixedInfo) |
| 629 | : MainBlock(std::move(TopLevelBlock)), FixedData(std::move(FixedInfo)) {} |
| 630 | |
| 631 | raw_ostream &log(raw_ostream &) const override; |
| 632 | }; |
| 633 | |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 634 | // CHARACTERISTICS optional statement. |
| 635 | // |
| 636 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa380872(v=vs.85).aspx |
| 637 | class CharacteristicsStmt : public OptionalStmt { |
Marek Sokolowski | 22fccd6 | 2017-09-29 19:07:44 +0000 | [diff] [blame] | 638 | public: |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 639 | uint32_t Value; |
| 640 | |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 641 | CharacteristicsStmt(uint32_t Characteristic) : Value(Characteristic) {} |
| 642 | raw_ostream &log(raw_ostream &) const override; |
Marek Sokolowski | 22fccd6 | 2017-09-29 19:07:44 +0000 | [diff] [blame] | 643 | |
| 644 | Twine getResourceTypeName() const override { return "CHARACTERISTICS"; } |
| 645 | Error visit(Visitor *V) const override { |
| 646 | return V->visitCharacteristicsStmt(this); |
| 647 | } |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 648 | }; |
| 649 | |
| 650 | // VERSION optional statement. |
| 651 | // |
| 652 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381059(v=vs.85).aspx |
| 653 | class VersionStmt : public OptionalStmt { |
Marek Sokolowski | 22fccd6 | 2017-09-29 19:07:44 +0000 | [diff] [blame] | 654 | public: |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 655 | uint32_t Value; |
| 656 | |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 657 | VersionStmt(uint32_t Version) : Value(Version) {} |
| 658 | raw_ostream &log(raw_ostream &) const override; |
Marek Sokolowski | 22fccd6 | 2017-09-29 19:07:44 +0000 | [diff] [blame] | 659 | |
| 660 | Twine getResourceTypeName() const override { return "VERSION"; } |
| 661 | Error visit(Visitor *V) const override { return V->visitVersionStmt(this); } |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 662 | }; |
| 663 | |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 664 | // CAPTION optional statement. |
| 665 | // |
| 666 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa380778(v=vs.85).aspx |
| 667 | class CaptionStmt : public OptionalStmt { |
Zachary Turner | 420090a | 2017-10-06 20:51:20 +0000 | [diff] [blame^] | 668 | public: |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 669 | StringRef Value; |
| 670 | |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 671 | CaptionStmt(StringRef Caption) : Value(Caption) {} |
| 672 | raw_ostream &log(raw_ostream &) const override; |
Zachary Turner | 420090a | 2017-10-06 20:51:20 +0000 | [diff] [blame^] | 673 | Twine getResourceTypeName() const override { return "CAPTION"; } |
| 674 | Error visit(Visitor *V) const override { return V->visitCaptionStmt(this); } |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 675 | }; |
| 676 | |
| 677 | // FONT optional statement. |
| 678 | // Note that the documentation is inaccurate: it expects five arguments to be |
| 679 | // given, however the example provides only two. In fact, the original tool |
| 680 | // expects two arguments - point size and name of the typeface. |
| 681 | // |
| 682 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381013(v=vs.85).aspx |
| 683 | class FontStmt : public OptionalStmt { |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 684 | public: |
Zachary Turner | 420090a | 2017-10-06 20:51:20 +0000 | [diff] [blame^] | 685 | uint32_t Size, Weight, Charset; |
| 686 | StringRef Name; |
| 687 | bool Italic; |
| 688 | |
| 689 | FontStmt(uint32_t FontSize, StringRef FontName, uint32_t FontWeight, |
| 690 | bool FontItalic, uint32_t FontCharset) |
| 691 | : Size(FontSize), Weight(FontWeight), Charset(FontCharset), |
| 692 | Name(FontName), Italic(FontItalic) {} |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 693 | raw_ostream &log(raw_ostream &) const override; |
Zachary Turner | 420090a | 2017-10-06 20:51:20 +0000 | [diff] [blame^] | 694 | Twine getResourceTypeName() const override { return "FONT"; } |
| 695 | Error visit(Visitor *V) const override { return V->visitFontStmt(this); } |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 696 | }; |
| 697 | |
| 698 | // STYLE optional statement. |
| 699 | // |
| 700 | // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381051(v=vs.85).aspx |
| 701 | class StyleStmt : public OptionalStmt { |
Zachary Turner | 420090a | 2017-10-06 20:51:20 +0000 | [diff] [blame^] | 702 | public: |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 703 | uint32_t Value; |
| 704 | |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 705 | StyleStmt(uint32_t Style) : Value(Style) {} |
| 706 | raw_ostream &log(raw_ostream &) const override; |
Zachary Turner | 420090a | 2017-10-06 20:51:20 +0000 | [diff] [blame^] | 707 | Twine getResourceTypeName() const override { return "STYLE"; } |
| 708 | Error visit(Visitor *V) const override { return V->visitStyleStmt(this); } |
Marek Sokolowski | 4ac54d9 | 2017-08-29 16:49:59 +0000 | [diff] [blame] | 709 | }; |
| 710 | |
Marek Sokolowski | 5cd3d5c | 2017-08-18 18:24:17 +0000 | [diff] [blame] | 711 | } // namespace rc |
| 712 | } // namespace llvm |
| 713 | |
| 714 | #endif |