[llvm-rc] Run clang to preprocess input files
Allow opting out from preprocessing with a command line argument.
Update tests to pass -no-preprocess to make it not try to use clang
(which isn't a build level dependency of llvm-rc), but add a test that
does preprocessing under clang/test/Preprocessor.
Update a few options to allow them both joined (as -DFOO) and separate
(-D BR), as rc.exe allows both forms of them.
With the verbose flag set, this prints the preprocessing command
used (which differs from what rc.exe does).
Tests under llvm/test/tools/llvm-rc only test constructing the
preprocessor commands, while tests under clang/test/Preprocessor test
actually running the preprocessor.
Differential Revision: https://reviews.llvm.org/D100755
GitOrigin-RevId: 64bc44f5ddfb6da4b6a8b51ea9a03f8772b3ae95
diff --git a/test/tools/llvm-rc/codepage.test b/test/tools/llvm-rc/codepage.test
index 5da7a5a..406ff00 100644
--- a/test/tools/llvm-rc/codepage.test
+++ b/test/tools/llvm-rc/codepage.test
@@ -1,4 +1,4 @@
-; RUN: llvm-rc /C 65001 /FO %t.utf8.res -- %p/Inputs/utf8.rc
+; RUN: llvm-rc -no-preprocess /C 65001 /FO %t.utf8.res -- %p/Inputs/utf8.rc
; RUN: llvm-readobj %t.utf8.res | FileCheck %s --check-prefix=UTF8
; UTF8: Resource type (int): STRINGTABLE (ID 6)
@@ -18,11 +18,11 @@
; UTF8-NEXT: 0040: 00000000 |....|
; UTF8-NEXT: )
-; RUN: not llvm-rc /C 65001 /FO %t.utf8-escape-narrow.res -- %p/Inputs/utf8-escape-narrow.rc 2>&1 | FileCheck %s --check-prefix UTF8_ESCAPE
+; RUN: not llvm-rc -no-preprocess /C 65001 /FO %t.utf8-escape-narrow.res -- %p/Inputs/utf8-escape-narrow.rc 2>&1 | FileCheck %s --check-prefix UTF8_ESCAPE
; UTF8_ESCAPE: llvm-rc: Error in STRINGTABLE statement (ID 1):
; UTF8_ESCAPE-NEXT: Unable to interpret single byte (195) as UTF-8
-; RUN: llvm-rc /C 1252 /FO %t.cp1252.res -- %p/Inputs/cp1252.rc
+; RUN: llvm-rc -no-preprocess /C 1252 /FO %t.cp1252.res -- %p/Inputs/cp1252.rc
; RUN: llvm-readobj %t.cp1252.res | FileCheck %s --check-prefix=CP1252
; CP1252: Resource type (int): STRINGTABLE (ID 6)