1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 10:32:48 +02:00
llvm-mirror/tools/llvm-rc
Martin Storsjo 4b44f3b8e4 [llvm-rc] Handle C preprocessor output
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
2018-05-09 18:21:03 +00:00
..
CMakeLists.txt [llvm-rc] Handle C preprocessor output 2018-05-09 18:21:03 +00:00
llvm-rc.cpp [llvm-rc] Handle C preprocessor output 2018-05-09 18:21:03 +00:00
LLVMBuild.txt
Opts.td [llvm-rc] Add rudimentary support for codepages 2018-05-02 19:43:44 +00:00
ResourceFileWriter.cpp [llvm-rc] Allow -1 for control IDs in old style dialogs with 16 bit fields 2018-05-09 18:20:49 +00:00
ResourceFileWriter.h [llvm-rc] Fix build: missing 'override'. 2018-05-07 21:06:53 +00:00
ResourceScriptCppFilter.cpp [llvm-rc] Handle C preprocessor output 2018-05-09 18:21:03 +00:00
ResourceScriptCppFilter.h [llvm-rc] Handle C preprocessor output 2018-05-09 18:21:03 +00:00
ResourceScriptParser.cpp [llvm-rc] Add support for the RCDATA resource type 2018-05-09 18:20:56 +00:00
ResourceScriptParser.h [llvm-rc] Don't strictly require quotes around external file names 2018-05-08 08:47:37 +00:00
ResourceScriptStmt.cpp [llvm-rc] Add support for all missing dialog controls 2018-05-08 20:55:58 +00:00
ResourceScriptStmt.h [llvm-rc] Add support for the RCDATA resource type 2018-05-09 18:20:56 +00:00
ResourceScriptToken.cpp [llvm-rc] Don't strictly require quotes around external file names 2018-05-08 08:47:37 +00:00
ResourceScriptToken.h [llvm-rc] Update a stale comment. NFC. 2018-05-08 12:33:54 +00:00
ResourceScriptTokenList.def llvm-rc/ResourceScriptTokenList.h: Turns this into a .def file to imply that it's non-modular 2017-11-21 00:23:19 +00:00
ResourceVisitor.h [llvm-rc] Implement the BITMAP resource type 2018-05-07 20:27:37 +00:00