summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-rc
Commit message (Collapse)AuthorAgeFilesLines
* llvm-rc - fix uninitialized variable warnings. NFC.Simon Pilgrim2019-11-182-2/+2
|
* [llvm] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-153-27/+27
| | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
* Fix typos: (re)?sor?uce -> (re)?sourceFangrui Song2019-04-261-1/+1
| | | | | | | | | | | Closes: https://github.com/llvm/llvm-project/pull/10 In-collaboration-with: Olivier Cochard-Labbé <olivier@FreeBSD.org> Signed-off-by: Enji Cooper <yaneurabeya@gmail.com> Differential Revision: https://reviews.llvm.org/D61021 llvm-svn: 359277
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1914-56/+42
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [llvm-rc] Support '--' for delimiting options from input pathsMartin Storsjo2019-01-161-1/+7
| | | | | | | | | | This allows avoiding conflicts between paths that begin with the same chars as some llvm-rc options (which can be used with either slashes or dashes). Differential Revision: https://reviews.llvm.org/D56743 llvm-svn: 351305
* [llvm-rc] Support not expressions.Martin Storsjo2018-12-055-20/+92
| | | | | | | | Patch by Jacek Caban! Differential Revision: https://reviews.llvm.org/D55242 llvm-svn: 348363
* [llvm-rc] Support EXSTYLE statement.Martin Storsjo2018-11-297-2/+37
| | | | | | | | Patch by Jacek Caban! Differential Revision: https://reviews.llvm.org/D55020 llvm-svn: 347858
* [llvm-rc] Support joined or separate spelling for /fo flagPetr Hosek2018-11-091-1/+1
| | | | | | | | | CMake invokes rc using the joined spelling which appears to be supported by Microsoft's rc implementation, so we should support it as well. Differential Revision: https://reviews.llvm.org/D54191 llvm-svn: 346470
* [llvm-rc] Support absolute filenames in manifestsPetr Hosek2018-11-081-2/+5
| | | | | | | | | | CMake generate manifests that contain absolute filenames and these currently result in assertion error. This change ensures that we handle these correctly. Differential Revision: https://reviews.llvm.org/D54194 llvm-svn: 346450
* [opt] Change the parameter of OptTable::PrintHelp from Name to Usage and ↵Fangrui Song2018-10-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | don't append "[options] <inputs>" Summary: Before, "[options] <inputs>" is unconditionally appended to the `Name` parameter. It is more flexible to change its semantic to `Usage` and let user customize the usage line. % llvm-objcopy ... USAGE: llvm-objcopy <input> [ <output> ] [options] <inputs> With this patch: % llvm-objcopy ... USAGE: llvm-objcopy input [output] Reviewers: rupprecht, alexshap, jhenderson Reviewed By: rupprecht Subscribers: jakehehrlich, mehdi_amini, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D51009 llvm-svn: 344097
* [FileSystem] Split up the OpenFlags enumeration.Zachary Turner2018-06-071-2/+2
| | | | | | | | | | | | | | | | | This breaks the OpenFlags enumeration into two separate enumerations: OpenFlags and CreationDisposition. The first controls the behavior of the API depending on whether or not the target file already exists, and is not a flags-based enum. The second controls more flags-like values. This yields a more easy to understand API, while also allowing flags to be passed to the openForRead api, where most of the values didn't make sense before. This also makes the apis more testable as it becomes easy to enumerate all the configurations which make sense, so I've added many new tests to exercise all the different values. llvm-svn: 334221
* [llvm-rc] Add support for the optional CLASS statement for dialogsMartin Storsjo2018-05-157-3/+39
| | | | | | Differential Revision: https://reviews.llvm.org/D46875 llvm-svn: 332386
* [llvm-rc] Add support for parsing memory flagsMartin Storsjo2018-05-155-52/+132
| | | | | | | | | | | | | | | | | | | | | | | | Most of the handling is pretty straightforward; fetch the default memory flags for the specific resource type before parsing the flags and apply them on top of that, except that some flags imply others and some flags clear more than one flag. For icons and cursors, the flags set get passed on to all individual single icon/cursor resources, while only some flags affect the icon/cursor group resource. For stringtables, the behaviour is pretty simple; the first stringtable resource of a bundle sets the flags for the whole bundle. The output of these tests match rc.exe byte for byte. The actual use of these memory flags is deprecated and they have no effect since Win16, but some resource script files may still happen to have them in place. Differential Revision: https://reviews.llvm.org/D46818 llvm-svn: 332329
* [llvm-rc] Read the Planes/BitCount fields from BITMAPINFOHEADER for iconsMartin Storsjo2018-05-151-20/+26
| | | | | | | | | | | | | | | | Previously these fields were only read from this header for cursors, while Planes was hardcoded to 1 for icons (with a comment that it was unknown why this was needed) and BitCount was left at the value read originally in the RESDIRENTRY. This fixes the single byte that was differing for the icon/cursor test compared to rc.exe. This is based on research/testing by Nico Weber. Differential Revision: https://reviews.llvm.org/D46816 llvm-svn: 332328
* [llvm-rc] Handle C preprocessor outputMartin Storsjo2018-05-094-1/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | When preprocessing resource scripts (which can easily be done outside of llvm-rc), included headers can leave behind C declarations (despite preprocessing with -DRC_INVOKED), that can't be parsed by a resource compiler. This is handled in all of rc.exe, by parsing the preprocessor output line markers and ignoring content from files named *.h and *.c, documented at [1]. In addition to this filtering, strip out any other preprocessor directive that is left behind (like pragmas) which also can't be handled by the tokenizer. The added test uses both standard #line markers (supported by rc.exe) and GNU style extended line markers, thus this test doesn't pass with rc.exe, but passes with GNU windres. (Windres on the other hand doesn't filter out files named *.c, only *.h.) Differential Revision: https://reviews.llvm.org/D46579 [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa381033(v=vs.85).aspx llvm-svn: 331903
* [llvm-rc] Add support for the RCDATA resource typeMartin Storsjo2018-05-092-0/+3
| | | | | | | | | This is the same as any other user defined resource, but with a specific allocated resource type number. Differential Revision: https://reviews.llvm.org/D46636 llvm-svn: 331902
* [llvm-rc] Allow -1 for control IDs in old style dialogs with 16 bit fieldsMartin Storsjo2018-05-091-2/+5
| | | | | | | | | | | -1 is commonly used as ID for controls that one don't want to refer to later. For DIALOG resources, the IDs are 16 bit numbers, and -1 gets interpreted as UINT32_MAX earlier, which then later is too large to write into a uint16_t. Differential Revision: https://reviews.llvm.org/D46506 llvm-svn: 331901
* [llvm-rc] Add support for all missing dialog controlsMartin Storsjo2018-05-084-10/+55
| | | | | | Differential Revision: https://reviews.llvm.org/D46507 llvm-svn: 331808
* [llvm-rc] Update a stale comment. NFC.Martin Storsjo2018-05-081-3/+2
| | | | | | The tokenizer handles comments since SVN r315207. llvm-svn: 331761
* [llvm-rc] Don't strictly require quotes around external file namesMartin Storsjo2018-05-083-7/+20
| | | | | | | | | | | | Regardless of what docs may say, existing resource files in the wild can use this syntax. Rename a file used in an existing test, to make it usable for unquoted paths. Differential Revision: https://reviews.llvm.org/D46511 llvm-svn: 331747
* [llvm-rc] Fix build: missing 'override'.Roman Lebedev2018-05-071-1/+1
| | | | llvm-svn: 331675
* [llvm-rc] Implement the BITMAP resource typeMartin Storsjo2018-05-077-0/+68
| | | | | | Differential Revision: https://reviews.llvm.org/D46509 llvm-svn: 331670
* [llvm-rc] Allow optional commas between the string table index and valueMartin Storsjo2018-05-071-0/+1
| | | | | | | | | This form is even used in one of the examples at https://msdn.microsoft.com/en-us/library/windows/desktop/aa381050(v=vs.85).aspx. Differential Revision: https://reviews.llvm.org/D46508 llvm-svn: 331669
* [llvm-rc] Exclude padding from sizes in versioninfo resourcesMartin Storsjo2018-05-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | Normally when writing something that requires padding, we first measure the length of the written payload data, then write padding if necessary. For a recursive structure like versioninfo, this means that the padding is excluded from the size of the inner element, but included in the size of the enclosing block. Rc.exe excludes the final padding (but not the padding of earlier children) from all levels of the hierarchy. To achieve this, don't pad after each block or value, but only before starting the next one. We still pad after completing the toplevel versioninfo resource, so this won't affect other resource types. Differential Revision: https://reviews.llvm.org/D46510 llvm-svn: 331668
* [llvm-rc] Fix alphabetical order of cases. NFC.Martin Storsjo2018-05-071-2/+2
| | | | llvm-svn: 331667
* [llvm-rc] Default to writing the output next to the input, if no output is ↵Martin Storsjo2018-05-021-1/+8
| | | | | | | | | | specified This matches what rc.exe does if no output is specified. Differential Revision: https://reviews.llvm.org/D46239 llvm-svn: 331403
* [llvm-rc] Add rudimentary support for codepagesMartin Storsjo2018-05-024-21/+93
| | | | | | | | | | | | | | | | | | | | | | Only support UTF-8 (since LLVM contains UTF-8 parsing support already, and the code even does that already) and Windows-1252 (where most code points has the same value in unicode). Keep the existing default as only allowing ASCII input. Using the option type JoinedOrSeparate, since the real rc.exe handles options in this form, even if llvm-rc uses Separate for other similar existing options. Rename the struct SearchParams to WriterParams since it's now used for more than just include paths. Add a missing getResourceTypeName method to the BundleResource class, to fix error printing from within STRINGTABLE resources (used in tests). Differential Revision: https://reviews.llvm.org/D46238 llvm-svn: 331391
* Define InitLLVM to do common initialization all at once.Rui Ueyama2018-04-131-12/+4
| | | | | | | | | | | We have a few functions that virtually all command wants to run on process startup/shutdown. This patch adds InitLLVM class to do that all at once, so that we don't need to copy-n-paste boilerplate code to each llvm command's main() function. Differential Revision: https://reviews.llvm.org/D45602 llvm-svn: 330046
* Fix typos of occurred and occurrenceMalcolm Parsons2018-01-242-2/+2
| | | | llvm-svn: 323318
* llvm-rc/ResourceScriptTokenList.h: Turns this into a .def file to imply that ↵David Blaikie2017-11-215-16/+9
| | | | | | | | it's non-modular Also undef the macros at the end of the file to make it easier to use. llvm-svn: 318714
* Don't #include MemoryBuffer.h from Host.h.Zachary Turner2017-11-173-0/+5
| | | | | | | | | | It turns out this #include isn't used from Host.h anyway, but by having it it causes circular include dependencies. This issues only surfaced while I was working on a separate patch, so I'm submitting this first so that it's independent of the other, unrelated patch. llvm-svn: 318489
* Fix incorrect integer literal suffix.Zachary Turner2017-10-111-4/+4
| | | | llvm-svn: 315501
* [llvm-rc] Use proper search algorithm for finding resources.Zachary Turner2017-10-115-29/+85
| | | | | | | | | | | | Previously we would only look in the current directory for a resource, which might not be the same as the directory of the rc file. Furthermore, MSVC rc supports a /I option, and can also look in the system environment. This patch adds support for this search algorithm. Differential Revision: https://reviews.llvm.org/D38740 llvm-svn: 315499
* [llvm-rc] Fix spelling in messageSimon Dardis2017-10-111-1/+1
| | | | llvm-svn: 315447
* [llvm-rc] Try again to fix errors on big endian systems.Zachary Turner2017-10-091-10/+8
| | | | llvm-svn: 315248
* Fix some C++ value / reference semantics issues.Zachary Turner2017-10-094-12/+8
| | | | | | | | | Some functions were taking Twine's not by const&, these are all fixed to take by const&. We also had a case where some functions were overloaded to accept by const& and &&. Now there is only one version which accepts by value and move's the value. llvm-svn: 315229
* [llvm-rc] Have the tokenizer discard single & block comments.Zachary Turner2017-10-092-0/+55
| | | | | | | | | | This allows rc files to have comments. Eventually we should just use clang's c preprocessor, but that's a bit larger effort for minimal gain, and this is straightforward. Differential Revision: https://reviews.llvm.org/D38651 llvm-svn: 315207
* [llvm-rc] Fix some endianness errors.Zachary Turner2017-10-061-11/+13
| | | | llvm-svn: 315128
* [llvm-rc] Implement escape sequences in .rc files.Zachary Turner2017-10-062-5/+159
| | | | | | | | | | | | | | | | | | | | | This allows the escape sequences (\a, \n, \r, \t, \\, \x[0-9a-f]*, \[0-7]*, "") to appear in .rc scripts. These are parsed and output in the same way as it's done in original MS implementation. The way these sequences are processed depends on the type of the resource it resides in, and on whether the user declared the string to be "wide" or "narrow". I tried to maintain the maximum compatibility with the original tool (and fail in some erroneous situations that are accepted by .rc). However, there are some (extremely rare) cases where Microsoft tool outputs nonsense. I found it infeasible to detect such casses. Patch by Marek Sokolowski Differential Revision: https://reviews.llvm.org/D38426 llvm-svn: 315118
* [llvm-rc] Serialize user-defined resources to .res files.Zachary Turner2017-10-064-1/+58
| | | | | | | | | | | | | | | | This allows rc to serialize user-defined resources, as documented at: msdn.microsoft.com/en-us/library/windows/desktop/aa381054.aspx Escape sequences are yet unavailable, and are to be added in one of child patches. Patch by: Marek Sokolowski Differential Revision: https://reviews.llvm.org/D38423 llvm-svn: 315117
* [llvm-rc] Serialize STRINGTABLE statements to .res file.Zachary Turner2017-10-065-9/+158
| | | | | | | | | | | | | | | 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
* [llvm-rc] Serialize VERSIONINFO resources to .res files.Zachary Turner2017-10-069-35/+325
| | | | | | | | | | | This is now able to dump VERSIONINFO resources. Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381058.aspx Differential Revision: https://reviews.llvm.org/D38410 Patch by: Marek Sokolowski llvm-svn: 315110
* [llvm-rc] Serialize CURSOR and ICON resources to .resZachary Turner2017-10-064-4/+303
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is part 6 of llvm-rc serialization. This adds ability to output cursors and icons as resources. Unfortunately, we can't just copy .cur or .ico files to output - as each file might contain multiple images, each of them needs to be unpacked and stored as a separate resource. This forces us to parse cursor and icon contents. (Fortunately, these formats are pretty similar and can be processed by mostly common code). As test files are binary, here is a short explanation of .cur and .ico files stored: cursor.cur, cursor-8.cur, cursor-32.cur are sample correct cursor files, differing in their bit depth. icon-old.ico, icon-new.ico are sample correct icon files; icon-png.ico is a sample correct icon file in PNG format (instead of usual BMP); cursor-eof.cur is an incorrect cursor file - this is cursor.cur with some of its final bytes removed. cursor-bad-offset.cur is an incorrect cursor file - image header states that image data begins at offset 0xFFFFFFFF. Sample correct cursors and icons were created by Nico Weber. Patch by Marek Sokolowski Differential Revision: https://reviews.llvm.org/D37878 llvm-svn: 315109
* [llvm-rc] Add optional serialization support for DIALOG(EX) resources.Zachary Turner2017-10-067-26/+138
| | | | | | | | | | | | | | | | | | 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
* [llvm-rc] Serialize DIALOG(EX) to .res files (serialization, pt 4).Marek Sokolowski2017-09-306-17/+229
| | | | | | | | | | | | | 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
* [llvm-rc] Serialize MENU resources to .res files (serialization, pt 3).Marek Sokolowski2017-09-294-4/+98
| | | | | | | | | | | | | | | | | | | | This allows MENU resources to be serialized. MENU resource statement doc: msdn.microsoft.com/en-us/library/windows/desktop/aa381025.aspx POPUP sub-statement doc: msdn.microsoft.com/en-us/library/windows/desktop/aa381030.aspx MENUITEM sub-statement doc: msdn.microsoft.com/en-us/library/windows/desktop/aa381024.aspx MENUHEADER structure: msdn.microsoft.com/en-us/library/windows/desktop/ms648018.aspx (and NORMALMENUITEM, POPUPMENUITEM structs). Thanks for Nico Weber for his original work in this area. Differential Revision: https://reviews.llvm.org/D37828 llvm-svn: 314562
* [llvm-rc] Serialize ACCELERATORS to .res files (serialization, pt 2).Marek Sokolowski2017-09-294-11/+205
| | | | | | | | | | | | | | | | | | | | This allows llvm-rc to serialize ACCELERATORS resources. Additionally, as this is the first type of resource to support basic optional resource statements (LANGUAGE, CHARACTERISTICS, VERSION), ACCELERATORS statement documentation: msdn.microsoft.com/en-us/library/windows/desktop/aa380610.aspx Accelerator table structure documentation: msdn.microsoft.com/en-us/library/windows/desktop/ms648010.aspx Optional resource statement fields are described in: msdn.microsoft.com/en-us/library/windows/desktop/ms648027.aspx Thanks for Nico Weber for his original work in this area. Differential Revision: https://reviews.llvm.org/D37824 llvm-svn: 314549
* [llvm-rc] Refactoring needed for ACCELERATORS and MENU resources.Marek Sokolowski2017-09-294-49/+72
| | | | | | | | | | | | | | | | | | | | This is a part of llvm-rc serialization patch set (serialization, pt 1.5). This: * Unifies the internal representation of flags in ACCELERATORS and MENU with the corresponding representation in .res files (noticed in https://reviews.llvm.org/D37828#inline-329828). * Creates an RCResource subclass, OptStatementsRCResource, describing resource statements that can declare resource-local optional statements (proposed in https://reviews.llvm.org/D37824#inline-329775). These modifications don't fit to any of the current patches, so I'm submitting them as a separate patch. Differential Revision: https://reviews.llvm.org/D37841 llvm-svn: 314541
* [llvm-rc] Serialize HTML resources to .res files (serialization, pt 1).Marek Sokolowski2017-09-297-5/+501
| | | | | | | | | | | | | | This allows to process HTML resources defined in .rc scripts and output them to resulting .res files. Additionally, some infrastructure allowing to output these files is created. This is the first resource type we can operate on. Thanks to Nico Weber for his original work in this area. Differential Revision: reviews.llvm.org/D37283 llvm-svn: 314538
* [llvm-rc] Import all make_unique invocations from llvm namespace.Marek Sokolowski2017-09-291-20/+22
| | | | | | | | Previous patch fixed one of LLVM buildbots (lld-x86_64-win7). However, some others have already been failing because of make_unique compilation error (llvm-clang-x86_64-expensive-checks-win). llvm-svn: 314480
OpenPOWER on IntegriCloud