[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/absolute.test b/test/tools/llvm-rc/absolute.test
index fd8b2d6..fd05453 100644
--- a/test/tools/llvm-rc/absolute.test
+++ b/test/tools/llvm-rc/absolute.test
@@ -1,7 +1,7 @@
 ; RUN: touch %t.manifest
 ; RUN: echo "1 24 \"%t.manifest\"" > %t.rc
-; RUN: llvm-rc -- %t.rc
+; RUN: llvm-rc -no-preprocess -- %t.rc
 ;; On Windows, try stripping out the drive name from the absolute path,
 ;; and make sure the path still is found.
 ; RUN: cat %t.rc | sed 's/"[a-zA-Z]:/"/' > %t2.rc
-; RUN: llvm-rc -- %t2.rc
+; RUN: llvm-rc -no-preprocess -- %t2.rc
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)
diff --git a/test/tools/llvm-rc/cpp-output.test b/test/tools/llvm-rc/cpp-output.test
index 6814187..00acfff 100644
--- a/test/tools/llvm-rc/cpp-output.test
+++ b/test/tools/llvm-rc/cpp-output.test
@@ -1,4 +1,4 @@
-; RUN: llvm-rc /FO %t -- %p/Inputs/cpp-output.rc
+; RUN: llvm-rc -no-preprocess /FO %t -- %p/Inputs/cpp-output.rc
 ; RUN: llvm-readobj %t | FileCheck %s
 
 ; CHECK:      Resource type (int): STRINGTABLE (ID 6)
diff --git a/test/tools/llvm-rc/flags.test b/test/tools/llvm-rc/flags.test
index 5b71481..d1bda51 100644
--- a/test/tools/llvm-rc/flags.test
+++ b/test/tools/llvm-rc/flags.test
@@ -1,4 +1,4 @@
-; RUN: llvm-rc /dry-run /FO %t -- %p/Inputs/empty.rc 2>&1 | FileCheck %s --allow-empty --check-prefix=FO
-; RUN: llvm-rc /dry-run /FO%t -- %p/Inputs/empty.rc 2>&1 | FileCheck %s --allow-empty --check-prefix=FO
+; RUN: llvm-rc -no-preprocess /dry-run /FO %t -- %p/Inputs/empty.rc 2>&1 | FileCheck %s --allow-empty --check-prefix=FO
+; RUN: llvm-rc -no-preprocess /dry-run /FO%t -- %p/Inputs/empty.rc 2>&1 | FileCheck %s --allow-empty --check-prefix=FO
 
 ; FO-NOT: Exactly one input file should be provided.
diff --git a/test/tools/llvm-rc/helpmsg.test b/test/tools/llvm-rc/helpmsg.test
index b9a55f6..60a99a4 100644
--- a/test/tools/llvm-rc/helpmsg.test
+++ b/test/tools/llvm-rc/helpmsg.test
@@ -15,6 +15,7 @@
 ; CHECK-NEXT:    /I <value>  Add an include path.
 ; CHECK-NEXT:    /LN <value> Set the default language name.
 ; CHECK-NEXT:    /L <value>  Set the default language identifier.
+; CHECK-NEXT:    /no-preprocess Don't try to preprocess the input file.
 ; CHECK-NEXT:    /N          Null-terminate all strings in the string table.
 ; CHECK-NEXT:    /U <value>  Undefine a symbol for the C preprocessor.
 ; CHECK-NEXT:    /V          Be verbose.
diff --git a/test/tools/llvm-rc/include-paths.test b/test/tools/llvm-rc/include-paths.test
index 0097ae8..932b2c2 100644
--- a/test/tools/llvm-rc/include-paths.test
+++ b/test/tools/llvm-rc/include-paths.test
@@ -1,31 +1,31 @@
 ; Should find the bitmap if it is in the same folder as the rc file.
 ; RUN: rm -f %t.include.res
-; RUN: llvm-rc /FO %t.include.res -- %p/Inputs/include.rc
+; RUN: llvm-rc -no-preprocess /FO %t.include.res -- %p/Inputs/include.rc
 ; RUN: llvm-readobj %t.include.res | FileCheck --check-prefix=FOUND %s
 
 ; Try including files without quotes.
 ; RUN: rm -f %t.noquotes.res
-; RUN: llvm-rc /FO %t.noquotes.res -- %p/Inputs/include-noquotes.rc
+; RUN: llvm-rc -no-preprocess /FO %t.noquotes.res -- %p/Inputs/include-noquotes.rc
 ; RUN: llvm-readobj %t.noquotes.res | FileCheck --check-prefix=FOUND %s
 
 ; Should find the bitmap if the folder is explicitly specified.
 ; RUN: rm -f %t.nested-include.res
-; RUN: llvm-rc /FO %t.nested-include.res /I %p/Inputs/nested -- %p/Inputs/deep-include.rc
+; RUN: llvm-rc -no-preprocess /FO %t.nested-include.res /I %p/Inputs/nested -- %p/Inputs/deep-include.rc
 ; RUN: llvm-readobj %t.nested-include.res | FileCheck --check-prefix=FOUND %s
 
 ; The include dir can be specified via the INCLUDE env var too.
 ; RUN: rm -f %t.nested-include.res
-; RUN: env INCLUDE=%p/Inputs/nested llvm-rc /FO %t.nested-include.res -- %p/Inputs/deep-include.rc
+; RUN: env INCLUDE=%p/Inputs/nested llvm-rc -no-preprocess /FO %t.nested-include.res -- %p/Inputs/deep-include.rc
 ; RUN: llvm-readobj %t.nested-include.res | FileCheck --check-prefix=FOUND %s
 
 ; Specifying the /X option should make it ignore the INCLUDE variable.
 ; RUN: rm -f %t.nested-include.res
-; RUN: not env INCLUDE=%p/Inputs/nested llvm-rc /X /FO %t.nested-include.res -- %p/Inputs/deep-include.rc 2>&1 \
+; RUN: not env INCLUDE=%p/Inputs/nested llvm-rc -no-preprocess /X /FO %t.nested-include.res -- %p/Inputs/deep-include.rc 2>&1 \
 ; RUN:   | FileCheck --check-prefix=MISSING %s
 
 ; Otherwise, it should not find the bitmap.
 ; RUN: rm -f %t.nested-include.res
-; RUN: not llvm-rc /FO %t.nested-include.res -- %p/Inputs/deep-include.rc 2>&1 \
+; RUN: not llvm-rc -no-preprocess /FO %t.nested-include.res -- %p/Inputs/deep-include.rc 2>&1 \
 ; RUN:   | FileCheck --check-prefix=MISSING %s
 
 ; Should find the bitmap if the process's current working directory
@@ -34,7 +34,7 @@
 ; failure of other tests if run first.
 ; RUN: rm -f %t.nested-include.res
 ; RUN: cd %p/Inputs/nested
-; RUN: llvm-rc /FO %t.nested-include.res -- %p/Inputs/include.rc
+; RUN: llvm-rc -no-preprocess /FO %t.nested-include.res -- %p/Inputs/include.rc
 ; RUN: llvm-readobj %t.nested-include.res | FileCheck --check-prefix=FOUND %s
 
 FOUND:      Resource type (int): BITMAP (ID 2)
diff --git a/test/tools/llvm-rc/language.test b/test/tools/llvm-rc/language.test
index e764cde..7e70ae1 100644
--- a/test/tools/llvm-rc/language.test
+++ b/test/tools/llvm-rc/language.test
@@ -1,6 +1,6 @@
-; RUN: llvm-rc /l 40A /FO %t.res -- %p/Inputs/language.rc
+; RUN: llvm-rc -no-preprocess /l 40A /FO %t.res -- %p/Inputs/language.rc
 ; RUN: llvm-readobj %t.res | FileCheck %s
-; RUN: llvm-rc /l40A /FO %t.res -- %p/Inputs/language.rc
+; RUN: llvm-rc -no-preprocess /l40A /FO %t.res -- %p/Inputs/language.rc
 ; RUN: llvm-readobj %t.res | FileCheck %s
 
 ; CHECK:      Resource name (int): 1
diff --git a/test/tools/llvm-rc/memoryflags-stringtable.test b/test/tools/llvm-rc/memoryflags-stringtable.test
index 24f68cd..3236c50 100644
--- a/test/tools/llvm-rc/memoryflags-stringtable.test
+++ b/test/tools/llvm-rc/memoryflags-stringtable.test
@@ -1,4 +1,4 @@
-; RUN: llvm-rc /FO %t -- %p/Inputs/memoryflags-stringtable.rc
+; RUN: llvm-rc -no-preprocess /FO %t -- %p/Inputs/memoryflags-stringtable.rc
 ; RUN: llvm-readobj %t | FileCheck %s
 
 ; CHECK:      Resource type (int): STRINGTABLE (ID 6)
diff --git a/test/tools/llvm-rc/memoryflags.test b/test/tools/llvm-rc/memoryflags.test
index cd9e53c..3d1fe9a 100644
--- a/test/tools/llvm-rc/memoryflags.test
+++ b/test/tools/llvm-rc/memoryflags.test
@@ -1,4 +1,4 @@
-; RUN: llvm-rc /FO %t -- %p/Inputs/memoryflags.rc
+; RUN: llvm-rc -no-preprocess /FO %t -- %p/Inputs/memoryflags.rc
 ; RUN: llvm-readobj %t | FileCheck %s
 
 ; CHECK:      Resource type (int): CURSOR (ID 1)
diff --git a/test/tools/llvm-rc/not-expr.test b/test/tools/llvm-rc/not-expr.test
index f785ec7..db7fee4 100644
--- a/test/tools/llvm-rc/not-expr.test
+++ b/test/tools/llvm-rc/not-expr.test
@@ -1,4 +1,4 @@
-; RUN: llvm-rc /FO %t -- %p/Inputs/not-expr.rc
+; RUN: llvm-rc -no-preprocess /FO %t -- %p/Inputs/not-expr.rc
 ; RUN: llvm-readobj %t | FileCheck %s --check-prefix=NOTEXPR
 
 ; NOTEXPR: Resource type (int): DIALOG (ID 5)
diff --git a/test/tools/llvm-rc/parser-expr.test b/test/tools/llvm-rc/parser-expr.test
index e16d29d..ed67965 100644
--- a/test/tools/llvm-rc/parser-expr.test
+++ b/test/tools/llvm-rc/parser-expr.test
@@ -1,4 +1,4 @@
-; RUN: llvm-rc /dry-run /V -- %p/Inputs/parser-expr.rc | FileCheck %s
+; RUN: llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-expr.rc | FileCheck %s
 
 ; CHECK:  Language: 5, Sublanguage: 1
 ; CHECK-NEXT:  Language: 3, Sublanguage: 2
@@ -17,36 +17,36 @@
 ; CHECK-NEXT:  Language: 5, Sublanguage: 7
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-expr-bad-binary-1.rc 2>&1 | FileCheck %s --check-prefix BINARY1
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-expr-bad-binary-1.rc 2>&1 | FileCheck %s --check-prefix BINARY1
 
 ; BINARY1: llvm-rc: Error parsing file: expected '-', '~', integer or '(', got &
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-expr-bad-binary-2.rc 2>&1 | FileCheck %s --check-prefix BINARY2
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-expr-bad-binary-2.rc 2>&1 | FileCheck %s --check-prefix BINARY2
 
 ; BINARY2: llvm-rc: Error parsing file: expected '-', '~', integer or '(', got |
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-expr-bad-binary-3.rc 2>&1 | FileCheck %s --check-prefix BINARY3
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-expr-bad-binary-3.rc 2>&1 | FileCheck %s --check-prefix BINARY3
 
 ; BINARY3: llvm-rc: Error parsing file: expected '-', '~', integer or '(', got +
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-expr-bad-unary.rc 2>&1 | FileCheck %s --check-prefix UNARY
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-expr-bad-unary.rc 2>&1 | FileCheck %s --check-prefix UNARY
 
 ; UNARY: llvm-rc: Error parsing file: expected ',', got ~
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-expr-unbalanced-1.rc 2>&1 | FileCheck %s --check-prefix UNBALANCED1
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-expr-unbalanced-1.rc 2>&1 | FileCheck %s --check-prefix UNBALANCED1
 
 ; UNBALANCED1: llvm-rc: Error parsing file: expected ')', got ,
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-expr-unbalanced-2.rc 2>&1 | FileCheck %s --check-prefix UNBALANCED2
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-expr-unbalanced-2.rc 2>&1 | FileCheck %s --check-prefix UNBALANCED2
 
 ; UNBALANCED2: llvm-rc: Error parsing file: expected ',', got )
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-expr-unbalanced-3.rc 2>&1 | FileCheck %s --check-prefix UNBALANCED3
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-expr-unbalanced-3.rc 2>&1 | FileCheck %s --check-prefix UNBALANCED3
 
 ; UNBALANCED3: llvm-rc: Error parsing file: expected ',', got )
diff --git a/test/tools/llvm-rc/parser.test b/test/tools/llvm-rc/parser.test
index e9f8cb9..2e1d981 100644
--- a/test/tools/llvm-rc/parser.test
+++ b/test/tools/llvm-rc/parser.test
@@ -1,4 +1,4 @@
-; RUN: llvm-rc /dry-run /V -- %p/Inputs/parser-correct-everything.rc | FileCheck %s --check-prefix PGOOD
+; RUN: llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-correct-everything.rc | FileCheck %s --check-prefix PGOOD
 
 ; PGOOD:  Icon (meh): "hello.bmp"
 ; PGOOD-NEXT:  Icon (Icon): "Icon"
@@ -100,156 +100,156 @@
 
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-stringtable-no-string.rc 2>&1 | FileCheck %s --check-prefix PSTRINGTABLE1
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-stringtable-no-string.rc 2>&1 | FileCheck %s --check-prefix PSTRINGTABLE1
 
 ; PSTRINGTABLE1:  llvm-rc: Error parsing file: expected string, got }
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-stringtable-weird-option.rc 2>&1 | FileCheck %s --check-prefix PSTRINGTABLE2
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-stringtable-weird-option.rc 2>&1 | FileCheck %s --check-prefix PSTRINGTABLE2
 
 ; PSTRINGTABLE2:  llvm-rc: Error parsing file: expected optional statement type, BEGIN or '{', got NONSENSETYPE
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-eof.rc 2>&1 | FileCheck %s --check-prefix PEOF
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-eof.rc 2>&1 | FileCheck %s --check-prefix PEOF
 
 ; PEOF:  llvm-rc: Error parsing file: expected '-', '~', integer or '(', got <EOF>
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-no-characteristics-arg.rc 2>&1 | FileCheck %s --check-prefix PCHARACTERISTICS1
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-no-characteristics-arg.rc 2>&1 | FileCheck %s --check-prefix PCHARACTERISTICS1
 
 ; PCHARACTERISTICS1:  llvm-rc: Error parsing file: expected '-', '~', integer or '(', got BEGIN
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-nonsense-token.rc 2>&1 | FileCheck %s --check-prefix PNONSENSE1
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-nonsense-token.rc 2>&1 | FileCheck %s --check-prefix PNONSENSE1
 
 ; PNONSENSE1:  llvm-rc: Error parsing file: expected int or identifier, got &
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-nonsense-type.rc 2>&1 | FileCheck %s --check-prefix PNONSENSE2
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-nonsense-type.rc 2>&1 | FileCheck %s --check-prefix PNONSENSE2
 
 ; PNONSENSE2:  llvm-rc: Error parsing file: expected filename, '{' or BEGIN, got <EOF>
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-nonsense-type-eof.rc 2>&1 | FileCheck %s --check-prefix PNONSENSE3
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-nonsense-type-eof.rc 2>&1 | FileCheck %s --check-prefix PNONSENSE3
 
 ; PNONSENSE3:  llvm-rc: Error parsing file: expected int or identifier, got <EOF>
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-language-no-comma.rc 2>&1 | FileCheck %s --check-prefix PLANGUAGE1
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-language-no-comma.rc 2>&1 | FileCheck %s --check-prefix PLANGUAGE1
 
 ; PLANGUAGE1:  llvm-rc: Error parsing file: expected ',', got 7
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-language-too-many-commas.rc 2>&1 | FileCheck %s --check-prefix PLANGUAGE2
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-language-too-many-commas.rc 2>&1 | FileCheck %s --check-prefix PLANGUAGE2
 
 ; PLANGUAGE2:  llvm-rc: Error parsing file: expected '-', '~', integer or '(', got ,
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-html-extra-comma.rc 2>&1 | FileCheck %s --check-prefix PHTML2
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-html-extra-comma.rc 2>&1 | FileCheck %s --check-prefix PHTML2
 
 ; PHTML2:  llvm-rc: Error parsing file: expected string, got ,
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-accelerators-bad-flag.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS1
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-accelerators-bad-flag.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS1
 
 ; PACCELERATORS1:  llvm-rc: Error parsing file: expected ASCII/VIRTKEY/NOINVERT/ALT/SHIFT/CONTROL, got HELLO
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-accelerators-bad-int-or-string.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS2
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-accelerators-bad-int-or-string.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS2
 
 ; PACCELERATORS2:  llvm-rc: Error parsing file: expected int or string, got NotIntOrString
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-accelerators-no-comma.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS3
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-accelerators-no-comma.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS3
 
 ; PACCELERATORS3:  llvm-rc: Error parsing file: expected int or string, got CONTROL
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-accelerators-no-comma-2.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS4
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-accelerators-no-comma-2.rc 2>&1 | FileCheck %s --check-prefix PACCELERATORS4
 
 ; PACCELERATORS4:  llvm-rc: Error parsing file: expected ',', got 10
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-menu-bad-id.rc 2>&1 | FileCheck %s --check-prefix PMENU1
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-menu-bad-id.rc 2>&1 | FileCheck %s --check-prefix PMENU1
 
 ; PMENU1:  llvm-rc: Error parsing file: expected '-', '~', integer or '(', got A
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-menu-bad-flag.rc 2>&1 | FileCheck %s --check-prefix PMENU2
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-menu-bad-flag.rc 2>&1 | FileCheck %s --check-prefix PMENU2
 
 ; PMENU2:  llvm-rc: Error parsing file: expected CHECKED/GRAYED/HELP/INACTIVE/MENUBARBREAK/MENUBREAK, got ERRONEOUS
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-menu-missing-block.rc 2>&1 | FileCheck %s --check-prefix PMENU3
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-menu-missing-block.rc 2>&1 | FileCheck %s --check-prefix PMENU3
 
 ; PMENU3:  llvm-rc: Error parsing file: expected '{', got POPUP
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-menu-misspelled-separator.rc 2>&1 | FileCheck %s --check-prefix PMENU4
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-menu-misspelled-separator.rc 2>&1 | FileCheck %s --check-prefix PMENU4
 
 ; PMENU4:  llvm-rc: Error parsing file: expected SEPARATOR or string, got NOTSEPARATOR
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-dialog-cant-give-helpid.rc 2>&1 | FileCheck %s --check-prefix PDIALOG1
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-cant-give-helpid.rc 2>&1 | FileCheck %s --check-prefix PDIALOG1
 
 ; PDIALOG1:  llvm-rc: Error parsing file: expected identifier, got ,
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-dialog-too-few-args.rc 2>&1 | FileCheck %s --check-prefix PDIALOG2
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-too-few-args.rc 2>&1 | FileCheck %s --check-prefix PDIALOG2
 
 ; PDIALOG2:  llvm-rc: Error parsing file: expected ',', got }
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-dialog-too-many-args.rc 2>&1 | FileCheck %s --check-prefix PDIALOG3
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-too-many-args.rc 2>&1 | FileCheck %s --check-prefix PDIALOG3
 
 ; PDIALOG3:  llvm-rc: Error parsing file: expected identifier, got ,
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-dialog-unknown-type.rc 2>&1 | FileCheck %s --check-prefix PDIALOG4
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-unknown-type.rc 2>&1 | FileCheck %s --check-prefix PDIALOG4
 
 ; PDIALOG4:  llvm-rc: Error parsing file: expected control type, END or '}', got UNKNOWN
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-dialog-unnecessary-string.rc 2>&1 | FileCheck %s --check-prefix PDIALOG5
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-unnecessary-string.rc 2>&1 | FileCheck %s --check-prefix PDIALOG5
 
 ; PDIALOG5:  llvm-rc: Error parsing file: expected '-', '~', integer or '(', got "This shouldn't be here"
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-dialog-simple-font.rc 2>&1 | FileCheck %s --check-prefix PDIALOG6
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-dialog-simple-font.rc 2>&1 | FileCheck %s --check-prefix PDIALOG6
 
 ; PDIALOG6:  llvm-rc: Error parsing file: expected identifier, got ,
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-versioninfo-wrong-fixed.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO1
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-wrong-fixed.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO1
 
 ; PVERSIONINFO1:  llvm-rc: Error parsing file: expected fixed VERSIONINFO statement type, got WEIRDFIXED
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-versioninfo-named-main-block.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO2
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-named-main-block.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO2
 
 ; PVERSIONINFO2:  llvm-rc: Error parsing file: expected fixed VERSIONINFO statement type, got BLOCK
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-versioninfo-unnamed-inner-block.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO3
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-unnamed-inner-block.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO3
 
 ; PVERSIONINFO3:  llvm-rc: Error parsing file: expected string, got {
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-versioninfo-unnamed-value.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO4
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-unnamed-value.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO4
 
 ; PVERSIONINFO4:  llvm-rc: Error parsing file: expected string, got END
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-versioninfo-bad-type.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO5
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-bad-type.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO5
 
 ; PVERSIONINFO5:  llvm-rc: Error parsing file: expected BLOCK or VALUE, got INCORRECT
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-versioninfo-repeated-fixed.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO6
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-versioninfo-repeated-fixed.rc 2>&1 | FileCheck %s --check-prefix PVERSIONINFO6
 
 ; PVERSIONINFO6:  llvm-rc: Error parsing file: expected yet unread fixed VERSIONINFO statement type, got FILEVERSION
 
 
-; RUN: not llvm-rc /dry-run /V -- %p/Inputs/parser-user-invalid-contents.rc 2>&1 | FileCheck %s --check-prefix PUSER1
+; RUN: not llvm-rc -no-preprocess /dry-run /V -- %p/Inputs/parser-user-invalid-contents.rc 2>&1 | FileCheck %s --check-prefix PUSER1
 
 ; PUSER1:  llvm-rc: Error parsing file: expected int or string, got InvalidToken
diff --git a/test/tools/llvm-rc/preproc.test b/test/tools/llvm-rc/preproc.test
new file mode 100644
index 0000000..f55e543
--- /dev/null
+++ b/test/tools/llvm-rc/preproc.test
@@ -0,0 +1,3 @@
+; RUN: llvm-rc -### -i%p "-DFOO1=\"foo bar\"" -UFOO2 -D FOO3 -- %p/Inputs/empty.rc | FileCheck %s
+
+; CHECK: {{^}} "clang" "--driver-mode=gcc" "-target" "{{.*}}-pc-windows-msvc-coff" "-E" "-xc" "-DRC_INVOKED" "{{.*}}empty.rc" "-o" "{{.*}}preproc-{{.*}}.rc" "-I" "{{.*}}" "-D" "FOO1=\"foo bar\"" "-U" "FOO2" "-D" "FOO3"{{$}}
diff --git a/test/tools/llvm-rc/tag-accelerators.test b/test/tools/llvm-rc/tag-accelerators.test
index 73ce6ae..336727f 100644
--- a/test/tools/llvm-rc/tag-accelerators.test
+++ b/test/tools/llvm-rc/tag-accelerators.test
@@ -1,4 +1,4 @@
-; RUN: llvm-rc /FO %t -- %p/Inputs/tag-accelerators.rc
+; RUN: llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-accelerators.rc
 ; RUN: llvm-readobj %t | FileCheck %s --check-prefix=ACCELERATORS
 
 ; ACCELERATORS: Resource type (int): ACCELERATOR (ID 9)
@@ -79,79 +79,79 @@
 ; ACCELERATORS-NEXT: )
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-accelerators-bad-id.rc 2>&1 | FileCheck %s --check-prefix BADID
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-accelerators-bad-id.rc 2>&1 | FileCheck %s --check-prefix BADID
 
 ; BADID: llvm-rc: Error in ACCELERATORS statement (ID 1):
 ; BADID-NEXT: ACCELERATORS entry ID (1234567) does not fit in 16 bits.
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-accelerators-ascii-virtkey.rc 2>&1 | FileCheck %s --check-prefix ASCII1
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-accelerators-ascii-virtkey.rc 2>&1 | FileCheck %s --check-prefix ASCII1
 
 ; ASCII1: llvm-rc: Error in ACCELERATORS statement (ID 2):
 ; ASCII1-NEXT: Accelerator ID 15: Accelerator can't be both ASCII and VIRTKEY
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-accelerators-ascii-control.rc 2>&1 | FileCheck %s --check-prefix ASCII2
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-accelerators-ascii-control.rc 2>&1 | FileCheck %s --check-prefix ASCII2
 
 ; ASCII2: llvm-rc: Error in ACCELERATORS statement (ID 2):
 ; ASCII2-NEXT: Accelerator ID 15: Can only apply ALT, SHIFT or CONTROL to VIRTKEY accelerators
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-accelerators-ascii-shift.rc 2>&1 | FileCheck %s --check-prefix ASCII3
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-accelerators-ascii-shift.rc 2>&1 | FileCheck %s --check-prefix ASCII3
 
 ; ASCII3: llvm-rc: Error in ACCELERATORS statement (ID 2):
 ; ASCII3-NEXT: Accelerator ID 15: Can only apply ALT, SHIFT or CONTROL to VIRTKEY accelerators
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-accelerators-ascii-alt.rc 2>&1 | FileCheck %s --check-prefix ASCII4
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-accelerators-ascii-alt.rc 2>&1 | FileCheck %s --check-prefix ASCII4
 
 ; ASCII4: llvm-rc: Error in ACCELERATORS statement (ID 2):
 ; ASCII4-NEXT: Accelerator ID 15: Can only apply ALT, SHIFT or CONTROL to VIRTKEY accelerators
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-accelerators-bad-key-id.rc 2>&1 | FileCheck %s --check-prefix BADKEYID
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-accelerators-bad-key-id.rc 2>&1 | FileCheck %s --check-prefix BADKEYID
 
 ; BADKEYID: llvm-rc: Error in ACCELERATORS statement (ID 9):
 ; BADKEYID-NEXT: Numeric event key ID (1234567) does not fit in 16 bits.
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-accelerators-too-short.rc 2>&1 | FileCheck %s --check-prefix LENGTH1
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-accelerators-too-short.rc 2>&1 | FileCheck %s --check-prefix LENGTH1
 
 ; LENGTH1: llvm-rc: Error in ACCELERATORS statement (ID 10):
 ; LENGTH1-NEXT: Accelerator ID 12: Accelerator string events should have length 1 or 2
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-accelerators-too-long.rc 2>&1 | FileCheck %s --check-prefix LENGTH2
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-accelerators-too-long.rc 2>&1 | FileCheck %s --check-prefix LENGTH2
 
 ; LENGTH2: llvm-rc: Error in ACCELERATORS statement (ID 12):
 ; LENGTH2-NEXT: Accelerator ID 5: Accelerator string events should have length 1 or 2
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-accelerators-only-caret.rc 2>&1 | FileCheck %s --check-prefix CARET1
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-accelerators-only-caret.rc 2>&1 | FileCheck %s --check-prefix CARET1
 
 ; CARET1: llvm-rc: Error in ACCELERATORS statement (ID 555):
 ; CARET1-NEXT: Accelerator ID 100: No character following '^' in accelerator event
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-accelerators-no-caret.rc 2>&1 | FileCheck %s --check-prefix CARET2
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-accelerators-no-caret.rc 2>&1 | FileCheck %s --check-prefix CARET2
 
 ; CARET2: llvm-rc: Error in ACCELERATORS statement (ID 50):
 ; CARET2-NEXT: Accelerator ID 1: Event string should be one-character, possibly preceded by '^'
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-accelerators-long-virtkey.rc 2>&1 | FileCheck %s --check-prefix CARET3
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-accelerators-long-virtkey.rc 2>&1 | FileCheck %s --check-prefix CARET3
 
 ; CARET3: llvm-rc: Error in ACCELERATORS statement (ID 100):
 ; CARET3-NEXT: Accelerator ID 10: VIRTKEY accelerator events can't be preceded by '^'
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-accelerators-control-nonalpha.rc 2>&1 | FileCheck %s --check-prefix NONALPHA1
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-accelerators-control-nonalpha.rc 2>&1 | FileCheck %s --check-prefix NONALPHA1
 
 ; NONALPHA1: llvm-rc: Error in ACCELERATORS statement (ID 100):
 ; NONALPHA1-NEXT: Accelerator ID 1: Control character accelerator event should be alphabetic
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-accelerators-virtual-nonalpha.rc 2>&1 | FileCheck %s --check-prefix NONALPHA2
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-accelerators-virtual-nonalpha.rc 2>&1 | FileCheck %s --check-prefix NONALPHA2
 
 ; NONALPHA2: llvm-rc: Error in ACCELERATORS statement (ID 42):
 ; NONALPHA2-NEXT: Accelerator ID 1: Non-alphanumeric characters cannot describe virtual keys
diff --git a/test/tools/llvm-rc/tag-dialog.test b/test/tools/llvm-rc/tag-dialog.test
index 023deeb..7e081c4 100644
--- a/test/tools/llvm-rc/tag-dialog.test
+++ b/test/tools/llvm-rc/tag-dialog.test
@@ -1,4 +1,4 @@
-; RUN: llvm-rc /FO %t -- %p/Inputs/tag-dialog.rc
+; RUN: llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-dialog.rc
 ; RUN: llvm-readobj %t | FileCheck %s --check-prefix=DIALOG
 
 ; DIALOG: Resource type (int): DIALOG (ID 5)
@@ -163,7 +163,7 @@
 ; DIALOG-NEXT: )
 
 
-; RUN: llvm-rc /FO %t -- %p/Inputs/tag-dialog-headers.rc
+; RUN: llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-dialog-headers.rc
 ; RUN: llvm-readobj %t | FileCheck %s --check-prefix=HEADERS
 
 ; HEADERS: Resource type (int): DIALOG (ID 5)
@@ -636,73 +636,73 @@
 ; HEADERS-NEXT: )
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-dialog-large-coord.rc 2>&1 | FileCheck %s --check-prefix COORD1
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-dialog-large-coord.rc 2>&1 | FileCheck %s --check-prefix COORD1
 
 ; COORD1: llvm-rc: Error in DIALOGEX statement (ID 1):
 ; COORD1-NEXT: Dialog x-coordinate (50000) does not fit in 16-bit signed integer type.
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-dialog-large-coord-neg.rc 2>&1 | FileCheck %s --check-prefix COORD2
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-dialog-large-coord-neg.rc 2>&1 | FileCheck %s --check-prefix COORD2
 
 ; COORD2: llvm-rc: Error in DIALOG statement (ID 1):
 ; COORD2-NEXT: Dialog y-coordinate (-40000) does not fit in 16-bit signed integer type.
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-dialog-large-size.rc 2>&1 | FileCheck %s --check-prefix COORD3
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-dialog-large-size.rc 2>&1 | FileCheck %s --check-prefix COORD3
 
 ; COORD3: llvm-rc: Error in DIALOGEX statement (ID 1):
 ; COORD3-NEXT: Dialog height (32768) does not fit in 16-bit signed integer type.
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-dialog-negative-size.rc 2>&1 | FileCheck %s --check-prefix COORD4
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-dialog-negative-size.rc 2>&1 | FileCheck %s --check-prefix COORD4
 
 ; COORD4: llvm-rc: Error in DIALOGEX statement (ID 1):
 ; COORD4-NEXT: Dialog width (-50) cannot be negative.
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-dialog-ctl-large-coord.rc 2>&1 | FileCheck %s --check-prefix CTL-COORD1
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-dialog-ctl-large-coord.rc 2>&1 | FileCheck %s --check-prefix CTL-COORD1
 
 ; CTL-COORD1: llvm-rc: Error in DIALOGEX statement (ID 1):
 ; CTL-COORD1-NEXT: Error in LTEXT control (ID 1):
 ; CTL-COORD1-NEXT: Dialog control x-coordinate (44444) does not fit in 16-bit signed integer type.
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-dialog-ctl-large-coord-neg.rc 2>&1 | FileCheck %s --check-prefix CTL-COORD2
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-dialog-ctl-large-coord-neg.rc 2>&1 | FileCheck %s --check-prefix CTL-COORD2
 
 ; CTL-COORD2: llvm-rc: Error in DIALOG statement (ID 1):
 ; CTL-COORD2-NEXT: Error in LTEXT control (ID 1):
 ; CTL-COORD2-NEXT: Dialog control y-coordinate (-32769) does not fit in 16-bit signed integer type.
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-dialog-ctl-large-size.rc 2>&1 | FileCheck %s --check-prefix CTL-COORD3
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-dialog-ctl-large-size.rc 2>&1 | FileCheck %s --check-prefix CTL-COORD3
 
 ; CTL-COORD3: llvm-rc: Error in DIALOGEX statement (ID 1):
 ; CTL-COORD3-NEXT: Error in LTEXT control (ID 1):
 ; CTL-COORD3-NEXT: Dialog control width (40000) does not fit in 16-bit signed integer type.
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-dialog-ctl-negative-size.rc 2>&1 | FileCheck %s --check-prefix CTL-COORD4
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-dialog-ctl-negative-size.rc 2>&1 | FileCheck %s --check-prefix CTL-COORD4
 
 ; CTL-COORD4: llvm-rc: Error in DIALOG statement (ID 1):
 ; CTL-COORD4-NEXT: Error in LTEXT control (ID 1):
 ; CTL-COORD4-NEXT: Dialog control height (-700) cannot be negative.
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-dialog-ctl-large-id.rc 2>&1 | FileCheck %s --check-prefix CTL-ID
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-dialog-ctl-large-id.rc 2>&1 | FileCheck %s --check-prefix CTL-ID
 
 ; CTL-ID: llvm-rc: Error in DIALOG statement (ID 5):
 ; CTL-ID-NEXT: Error in RTEXT control (ID 100000):
 ; CTL-ID-NEXT: Control ID in simple DIALOG resource (100000) does not fit in 16 bits.
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-dialog-ctl-large-ref-id.rc 2>&1 | FileCheck %s --check-prefix CTL-REF-ID
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-dialog-ctl-large-ref-id.rc 2>&1 | FileCheck %s --check-prefix CTL-REF-ID
 
 ; CTL-REF-ID: llvm-rc: Error in DIALOGEX statement (ID 1):
 ; CTL-REF-ID-NEXT: Error in CTEXT control (ID 42):
 ; CTL-REF-ID-NEXT: Control reference ID (65536) does not fit in 16 bits.
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-dialog-bad-style.rc 2>&1 | FileCheck %s --check-prefix STYLE
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-dialog-bad-style.rc 2>&1 | FileCheck %s --check-prefix STYLE
 
 ; STYLE: llvm-rc: Error in DIALOG statement (ID 1):
 ; STYLE-NEXT: 16 higher bits of DIALOG resource style cannot be equal to 0xFFFF
diff --git a/test/tools/llvm-rc/tag-escape.test b/test/tools/llvm-rc/tag-escape.test
index 667a7e6..5c8beb6 100644
--- a/test/tools/llvm-rc/tag-escape.test
+++ b/test/tools/llvm-rc/tag-escape.test
@@ -1,4 +1,4 @@
-; RUN: llvm-rc /FO %t -- %p/Inputs/tag-escape.rc
+; RUN: llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-escape.rc
 ; RUN: llvm-readobj %t | FileCheck %s
 
 ; CHECK:      Resource type (int): MENU (ID 4)
diff --git a/test/tools/llvm-rc/tag-html.test b/test/tools/llvm-rc/tag-html.test
index 30e873e..3620fe9 100644
--- a/test/tools/llvm-rc/tag-html.test
+++ b/test/tools/llvm-rc/tag-html.test
@@ -1,6 +1,6 @@
 ; RUN: rm -rf %t && mkdir %t && cd %t
 ; RUN: cp %p/Inputs/webpage*.html .
-; RUN: llvm-rc /FO %t/tag-html.res -- %p/Inputs/tag-html.rc
+; RUN: llvm-rc -no-preprocess /FO %t/tag-html.res -- %p/Inputs/tag-html.rc
 ; RUN: llvm-readobj %t/tag-html.res | FileCheck %s --check-prefix HTML
 
 ; HTML: Resource type (int): HTML (ID 23)
diff --git a/test/tools/llvm-rc/tag-icon-cursor.test b/test/tools/llvm-rc/tag-icon-cursor.test
index 1451c4a..cfff799 100644
--- a/test/tools/llvm-rc/tag-icon-cursor.test
+++ b/test/tools/llvm-rc/tag-icon-cursor.test
@@ -1,7 +1,7 @@
 ; RUN: rm -rf %t
 ; RUN: mkdir %t
 
-; RUN: llvm-rc /FO %t/tag-icon-cursor.res -- %p/Inputs/tag-icon-cursor.rc
+; RUN: llvm-rc -no-preprocess /FO %t/tag-icon-cursor.res -- %p/Inputs/tag-icon-cursor.rc
 ; RUN: llvm-readobj %t/tag-icon-cursor.res | FileCheck %s
 
 ; CHECK: Resource type (int): CURSOR (ID 1)
@@ -320,12 +320,12 @@
 ; CHECK-NEXT: )
 
 
-; RUN: not llvm-rc /FO %t/1 -- %p/Inputs/tag-icon-cursor-nonexistent.rc 2>&1 | FileCheck %s --check-prefix NOFILE
+; RUN: not llvm-rc -no-preprocess /FO %t/1 -- %p/Inputs/tag-icon-cursor-nonexistent.rc 2>&1 | FileCheck %s --check-prefix NOFILE
 ; NOFILE: llvm-rc: Error in CURSOR statement (ID 500):
 ; NOFILE-NEXT: file not found : this-file-does-not-exist.cur
 
 
-; RUN: not llvm-rc /FO %t/1 -- %p/Inputs/tag-icon-cursor-nonsense.rc 2>&1 | FileCheck %s --check-prefix NONSENSE
+; RUN: not llvm-rc -no-preprocess /FO %t/1 -- %p/Inputs/tag-icon-cursor-nonsense.rc 2>&1 | FileCheck %s --check-prefix NONSENSE
 
 ; NONSENSE: llvm-rc: Error in ICON statement (ID 1):
 ; NONSENSE-NEXT: Incorrect icon/cursor Reserved field; should be 0.
diff --git a/test/tools/llvm-rc/tag-menu.test b/test/tools/llvm-rc/tag-menu.test
index 58c856b..3a17b22 100644
--- a/test/tools/llvm-rc/tag-menu.test
+++ b/test/tools/llvm-rc/tag-menu.test
@@ -1,9 +1,9 @@
-; RUN: llvm-rc /FO %t -- %p/Inputs/tag-menu.rc
+; RUN: llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-menu.rc
 ; RUN: llvm-readobj %t | FileCheck %s --check-prefix=MENU
 
-; Test running llvm-rc without an explicit output file.
+; Test running llvm-rc -no-preprocess without an explicit output file.
 ; RUN: cp %p/Inputs/tag-menu.rc %t.implicit.rc
-; RUN: llvm-rc -- %t.implicit.rc
+; RUN: llvm-rc -no-preprocess -- %t.implicit.rc
 ; RUN: llvm-readobj %t.implicit.res | FileCheck --check-prefix=MENU %s
 
 ; MENU: Resource type (int): MENU (ID 4)
@@ -74,7 +74,7 @@
 ; MENU-NEXT: )
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-menu-bad-menuitem-id.rc 2>&1 | FileCheck %s --check-prefix BADID
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-menu-bad-menuitem-id.rc 2>&1 | FileCheck %s --check-prefix BADID
 
 ; BADID: llvm-rc: Error in MENU statement (ID 1):
 ; BADID-NEXT: MENUITEM action ID (100000) does not fit in 16 bits.
diff --git a/test/tools/llvm-rc/tag-stringtable.test b/test/tools/llvm-rc/tag-stringtable.test
index dd7946e..f62215a 100644
--- a/test/tools/llvm-rc/tag-stringtable.test
+++ b/test/tools/llvm-rc/tag-stringtable.test
@@ -1,4 +1,4 @@
-; RUN: llvm-rc /FO %t -- %p/Inputs/tag-stringtable-basic.rc
+; RUN: llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-stringtable-basic.rc
 ; RUN: llvm-readobj %t | FileCheck %s
 
 ; CHECK:      Resource type (int): STRINGTABLE (ID 6)
@@ -81,7 +81,7 @@
 ; CHECK-NEXT: )
 
 
-; RUN: llvm-rc /N /FO %t0 -- %p/Inputs/tag-stringtable-basic.rc
+; RUN: llvm-rc -no-preprocess /N /FO %t0 -- %p/Inputs/tag-stringtable-basic.rc
 ; RUN: llvm-readobj %t0 | FileCheck %s --check-prefix=NULL
 
 ; NULL:      Resource type (int): STRINGTABLE (ID 6)
@@ -166,5 +166,5 @@
 ; NULL-NEXT: )
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-stringtable-same-ids.rc 2>&1 | FileCheck %s --check-prefix SAMEIDS
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-stringtable-same-ids.rc 2>&1 | FileCheck %s --check-prefix SAMEIDS
 ; SAMEIDS: llvm-rc: Multiple STRINGTABLE strings located under ID 1
diff --git a/test/tools/llvm-rc/tag-user.test b/test/tools/llvm-rc/tag-user.test
index 44c8b75..fb17d93 100644
--- a/test/tools/llvm-rc/tag-user.test
+++ b/test/tools/llvm-rc/tag-user.test
@@ -2,7 +2,7 @@
 ; RUN: mkdir %t
 ; RUN: cd %t
 ; RUN: cp %p/Inputs/bitmap.bmp .
-; RUN: llvm-rc /FO %t/tag-user.res -- %p/Inputs/tag-user.rc
+; RUN: llvm-rc -no-preprocess /FO %t/tag-user.res -- %p/Inputs/tag-user.rc
 ; RUN: llvm-readobj %t/tag-user.res | FileCheck %s
 
 ; CHECK:      Resource type (int): ID 500
diff --git a/test/tools/llvm-rc/tag-versioninfo.test b/test/tools/llvm-rc/tag-versioninfo.test
index 3ce534b..472bc57 100644
--- a/test/tools/llvm-rc/tag-versioninfo.test
+++ b/test/tools/llvm-rc/tag-versioninfo.test
@@ -1,4 +1,4 @@
-; RUN: llvm-rc /FO %t -- %p/Inputs/tag-versioninfo.rc
+; RUN: llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-versioninfo.rc
 ; RUN: llvm-readobj %t | FileCheck %s
 
 ; CHECK:      Resource type (int): VERSIONINFO (ID 16)
@@ -56,11 +56,11 @@
 ; CHECK-NEXT: )
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-versioninfo-mixed-ints-strings.rc 2>&1 | FileCheck %s --check-prefix STRINT
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-versioninfo-mixed-ints-strings.rc 2>&1 | FileCheck %s --check-prefix STRINT
 ; STRINT: llvm-rc: Error in VERSIONINFO statement (ID 1):
 ; STRINT-NEXT: VALUE "FileDescription" cannot contain both strings and integers
 
 
-; RUN: not llvm-rc /FO %t -- %p/Inputs/tag-versioninfo-word-too-large.rc 2>&1 | FileCheck %s --check-prefix WORD
+; RUN: not llvm-rc -no-preprocess /FO %t -- %p/Inputs/tag-versioninfo-word-too-large.rc 2>&1 | FileCheck %s --check-prefix WORD
 ; WORD: llvm-rc: Error in VERSIONINFO statement (ID 1):
 ; WORD-NEXT: VERSIONINFO integer value (65536) does not fit in 16 bits.
diff --git a/test/tools/llvm-rc/tokenizer.test b/test/tools/llvm-rc/tokenizer.test
index 5916467..eb2233c 100644
--- a/test/tools/llvm-rc/tokenizer.test
+++ b/test/tools/llvm-rc/tokenizer.test
@@ -1,4 +1,4 @@
-; RUN: not llvm-rc /V /FO %t.res -- %p/Inputs/tokens.rc | FileCheck %s
+; RUN: not llvm-rc -no-preprocess /V /FO %t.res -- %p/Inputs/tokens.rc | FileCheck %s
 ; llvm-rc fails now on this sample because it is an invalid resource file
 ; script. We silence the error message and just analyze the output.
 
diff --git a/test/tools/llvm-rc/versioninfo-padding.test b/test/tools/llvm-rc/versioninfo-padding.test
index 41f5df8..bd230f4 100644
--- a/test/tools/llvm-rc/versioninfo-padding.test
+++ b/test/tools/llvm-rc/versioninfo-padding.test
@@ -1,4 +1,4 @@
-; RUN: llvm-rc /FO %t -- %p/Inputs/versioninfo-padding.rc
+; RUN: llvm-rc -no-preprocess /FO %t -- %p/Inputs/versioninfo-padding.rc
 ; RUN: llvm-readobj %t | FileCheck %s
 
 ; CHECK:      Resource type (int): VERSIONINFO (ID 16)