summaryrefslogtreecommitdiff
path: root/tools/llvm-rc
AgeCommit message (Collapse)Author
2017-11-21llvm-rc/ResourceScriptTokenList.h: Turns this into a .def file to imply that ↵David Blaikie
it's non-modular Also undef the macros at the end of the file to make it easier to use. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318714 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17Don't #include MemoryBuffer.h from Host.h.Zachary Turner
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318489 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11Fix incorrect integer literal suffix.Zachary Turner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315501 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11[llvm-rc] Use proper search algorithm for finding resources.Zachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315499 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11[llvm-rc] Fix spelling in messageSimon Dardis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315447 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09[llvm-rc] Try again to fix errors on big endian systems.Zachary Turner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315248 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09Fix some C++ value / reference semantics issues.Zachary Turner
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315229 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09[llvm-rc] Have the tokenizer discard single & block comments.Zachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315207 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06[llvm-rc] Fix some endianness errors.Zachary Turner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315128 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06[llvm-rc] Implement escape sequences in .rc files.Zachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315118 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06[llvm-rc] Serialize user-defined resources to .res files.Zachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315117 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06[llvm-rc] Serialize STRINGTABLE statements to .res file.Zachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315112 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06[llvm-rc] Serialize VERSIONINFO resources to .res files.Zachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315110 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06[llvm-rc] Serialize CURSOR and ICON resources to .resZachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315109 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06[llvm-rc] Add optional serialization support for DIALOG(EX) resources.Zachary Turner
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315104 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-30[llvm-rc] Serialize DIALOG(EX) to .res files (serialization, pt 4).Marek Sokolowski
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314578 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29[llvm-rc] Serialize MENU resources to .res files (serialization, pt 3).Marek Sokolowski
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314562 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29[llvm-rc] Serialize ACCELERATORS to .res files (serialization, pt 2).Marek Sokolowski
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314549 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29[llvm-rc] Refactoring needed for ACCELERATORS and MENU resources.Marek Sokolowski
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314541 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29[llvm-rc] Serialize HTML resources to .res files (serialization, pt 1).Marek Sokolowski
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314538 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29[llvm-rc] Import all make_unique invocations from llvm namespace.Marek Sokolowski
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). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314480 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29[llvm-rc] Add user-defined resources parsing ability. [8/8]Marek Sokolowski
This allows llvm-rc to parse user-defined resources (ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381054.aspx). These statements either import files, or put the specified raw data in the resulting resource file. Thanks to Nico Weber for his original work in this area. Differential Revision: https://reviews.llvm.org/D37033 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314478 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28[llvm-rc] Add integer expressions parsing ability. [7/8]Marek Sokolowski
This allows the ints to be written as integer expressions evaluating to unsigned 16-bit/32-bit integers. All the expressions may use the following operators: + - & | ~, and parentheses. Minus token - can be also unary. There is no precedence of the operators other than the unary operators binding stronger than their binary counterparts. Differential Revision: https://reviews.llvm.org/D37022 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314477 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28[llvm-rc] Fix-up for r314468 (argument-dependent lookup in make_unique).Marek Sokolowski
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314472 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28[llvm-rc] Add VERSIONINFO parsing ability. [6/8]Marek Sokolowski
This extends the set of llvm-rc parser's available resources by another one, VERSIONINFO. Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381058.aspx Thanks to Nico Weber for his original work in this area. Differential Revision: https://reviews.llvm.org/D37021 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314468 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-07Fixing incorrectly capitalised regexps.Benjamin Kramer
Patch by Sam Allen! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312709 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-29[llvm-rc] Fix DIALOG(EX) parsing ability (parser, pt 5/8).Marek Sokolowski
This fixes a use-after-free bug that was noticed by a sanitizer buildbot (http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/7502). Differential Revision: https://reviews.llvm.org/D37271 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312028 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-29[llvm-rc] Add DIALOG(EX) parsing ability (parser, pt 5/8).Marek Sokolowski
This extends the set of resources parsed by llvm-rc by DIALOG and DIALOGEX. Additionally, three optional resource statements specific to these two resources are added: CAPTION, FONT, and STYLE. Thanks for Nico Weber for his original work in this area. Differential Revision: https://reviews.llvm.org/D36905 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312009 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28[llvm-rc] Add MENU parsing ability (parser, pt 4/8).Marek Sokolowski
This extends llvm-rc parsing tool by MENU resource (msdn.microsoft.com/en-us/library/windows/desktop/aa381025(v=vs.85).aspx). As for now, MENUEX (msdn.microsoft.com/en-us/library/windows/desktop/aa381023(v=vs.85).aspx) seems unnecessary. Thanks for Nico Weber for his original work in this area. Differential Revision: https://reviews.llvm.org/D36898 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311956 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28[llvm-rc] Add ACCELERATORS parsing ability. (parser, pt 3/8).Marek Sokolowski
This improves the current llvm-rc parser by the ability of parsing ACCELERATORS statement. Moreover, some small improvements to the original parsing commit were made. Thanks for Nico Weber for his original work in this area. Differential Revision: https://reviews.llvm.org/D36894 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311946 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28[llvm-rc] Add ICON and HTML parsing ability (parser, pt 2/8).Marek Sokolowski
This extends the current llvm-rc parser by ICON and HTML resources. Moreover, some tests have been slightly rewritten. Thanks for Nico Weber for his original work in this area. Differential Revision: https://reviews.llvm.org/D36891 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311939 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-18Reapply: [llvm-rc] Add basic RC scripts parsing ability.Marek Sokolowski
As for now, the parser supports a limited set of statements and resources. This will be extended in the following patches. Thanks to Nico Weber (thakis) for his original work in this area. This patch was originally submitted as r311175 and got reverted in r311177 because of the problems with compilation under gcc. Differential Revision: https://reviews.llvm.org/D36340 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311184 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-18Revert "[llvm-rc] Add basic RC scripts parsing ability."Marek Sokolowski
This reverts commit r311175. This failed some buildbots compilation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311177 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-18[llvm-rc] Add basic RC scripts parsing ability.Marek Sokolowski
As for now, the parser supports a limited set of statements and resources. This will be extended in the following patches. Thanks to Nico Weber (thakis) for his original work in this area. Differential Revision: https://reviews.llvm.org/D36340 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311175 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-10Fix 'not all control paths return' warning on windows builds. NFCI.Simon Pilgrim
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310631 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-10Fixup for r310621: Hint the compilers about unreachable code.Marek Sokolowski
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310623 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-10Add .rc scripts tokenizer.Marek Sokolowski
This extends the shell of llvm-rc tool with the ability of tokenization of the input files. Currently, ASCII and ASCII-compatible UTF-8 files are supported. Thanks to Nico Weber (thakis) for his original work in this area. Differential Revision: https://reviews.llvm.org/D35957 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310621 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25llvm-rc: Fixup for r308940. This should use LLVMSupport.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308941 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25Add an empty shell of llvm-rc.Marek Sokolowski
This starts the development on one of MS Visual Studio binutils, Resource Converter. The tool compiles resource scripts (.rc) into binary resource files (.res). The current implementation does nothing but parse the command line arguments. It is going to be extended in the future. Differential Revision: https://reviews.llvm.org/D35810 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308940 91177308-0d34-0410-b5e6-96231b3b80d8