diff --git a/test/tools/llvm-rc/absolute.test b/test/tools/llvm-rc/absolute.test index 5e8a6c8c336..95aff3e4244 100644 --- a/test/tools/llvm-rc/absolute.test +++ b/test/tools/llvm-rc/absolute.test @@ -1,3 +1,3 @@ ; RUN: touch %t.manifest ; RUN: echo "1 24 \"%t.manifest\"" > %t.rc -; RUN: llvm-rc %t.rc +; RUN: llvm-rc -- %t.rc diff --git a/test/tools/llvm-rc/codepage.test b/test/tools/llvm-rc/codepage.test index ce17e0a6b2b..05e3181b582 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 /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): 6 diff --git a/test/tools/llvm-rc/cpp-output.test b/test/tools/llvm-rc/cpp-output.test index 456a59da7a7..984e9fd7da4 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 /FO %t -- %p/Inputs/cpp-output.rc ; RUN: llvm-readobj %t | FileCheck %s ; CHECK: Resource type (int): 6 diff --git a/test/tools/llvm-rc/flags.test b/test/tools/llvm-rc/flags.test index 452e90a406b..5b71481af2d 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 /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 ; FO-NOT: Exactly one input file should be provided. diff --git a/test/tools/llvm-rc/include-paths.test b/test/tools/llvm-rc/include-paths.test index e6c52b12d6d..10a77e6de16 100644 --- a/test/tools/llvm-rc/include-paths.test +++ b/test/tools/llvm-rc/include-paths.test @@ -1,21 +1,21 @@ ; 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 /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 /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 /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 ; 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 /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 @@ -24,7 +24,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 /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): 2 diff --git a/test/tools/llvm-rc/memoryflags-stringtable.test b/test/tools/llvm-rc/memoryflags-stringtable.test index f168beda7b9..e8a2d40e8fe 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 /FO %t -- %p/Inputs/memoryflags-stringtable.rc ; RUN: llvm-readobj %t | FileCheck %s ; CHECK: Resource type (int): 6 diff --git a/test/tools/llvm-rc/memoryflags.test b/test/tools/llvm-rc/memoryflags.test index c36fb9bda8e..14e1193d1f6 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 /FO %t -- %p/Inputs/memoryflags.rc ; RUN: llvm-readobj %t | FileCheck %s ; CHECK: Resource type (int): 1 diff --git a/test/tools/llvm-rc/not-expr.test b/test/tools/llvm-rc/not-expr.test index c60223425c7..43725ed4f43 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 /FO %t -- %p/Inputs/not-expr.rc ; RUN: llvm-readobj %t | FileCheck %s --check-prefix=NOTEXPR ; NOTEXPR: Resource type (int): 5 diff --git a/test/tools/llvm-rc/parser-expr.test b/test/tools/llvm-rc/parser-expr.test index 9558f9305f3..1fb6aa62fde 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 /dry-run /V -- %p/Inputs/parser-expr.rc | FileCheck %s ; CHECK: Language: 5, Sublanguage: 1 ; CHECK-NEXT: Language: 3, Sublanguage: 2 diff --git a/test/tools/llvm-rc/parser.test b/test/tools/llvm-rc/parser.test index 66ed7386e82..4f10d7886a7 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 /dry-run /V -- %p/Inputs/parser-correct-everything.rc | FileCheck %s --check-prefix PGOOD ; PGOOD: Icon (meh): "hello.bmp" ; PGOOD-NEXT: Icon (Icon): "Icon" diff --git a/test/tools/llvm-rc/tag-accelerators.test b/test/tools/llvm-rc/tag-accelerators.test index 093a0bddbb6..910bf218633 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 /FO %t -- %p/Inputs/tag-accelerators.rc ; RUN: llvm-readobj %t | FileCheck %s --check-prefix=ACCELERATORS ; ACCELERATORS: Resource type (int): 9 diff --git a/test/tools/llvm-rc/tag-dialog.test b/test/tools/llvm-rc/tag-dialog.test index 85a8c20edc7..d44326e80a1 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 /FO %t -- %p/Inputs/tag-dialog.rc ; RUN: llvm-readobj %t | FileCheck %s --check-prefix=DIALOG ; DIALOG: Resource type (int): 5 diff --git a/test/tools/llvm-rc/tag-escape.test b/test/tools/llvm-rc/tag-escape.test index 7c58e9953e4..51c3d928e79 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 /FO %t -- %p/Inputs/tag-escape.rc ; RUN: llvm-readobj %t | FileCheck %s ; CHECK: Resource type (int): 4 diff --git a/test/tools/llvm-rc/tag-html.test b/test/tools/llvm-rc/tag-html.test index 571e1bcb46c..efeb04b0f2f 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 /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): 23 diff --git a/test/tools/llvm-rc/tag-icon-cursor.test b/test/tools/llvm-rc/tag-icon-cursor.test index 44ef6841165..b4301f5d593 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 /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): 1 diff --git a/test/tools/llvm-rc/tag-menu.test b/test/tools/llvm-rc/tag-menu.test index 25dc395a1d9..91e24457956 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 /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. ; RUN: cp %p/Inputs/tag-menu.rc %t.implicit.rc -; RUN: llvm-rc %t.implicit.rc +; RUN: llvm-rc -- %t.implicit.rc ; RUN: llvm-readobj %t.implicit.res | FileCheck --check-prefix=MENU %s ; MENU: Resource type (int): 4 diff --git a/test/tools/llvm-rc/tag-stringtable.test b/test/tools/llvm-rc/tag-stringtable.test index 43b5f5c9658..8dc4e57c6fd 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 /FO %t -- %p/Inputs/tag-stringtable-basic.rc ; RUN: llvm-readobj %t | FileCheck %s ; CHECK: Resource type (int): 6 diff --git a/test/tools/llvm-rc/tag-user.test b/test/tools/llvm-rc/tag-user.test index c0c1cfd1823..e93899cdd8a 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 /FO %t/tag-user.res -- %p/Inputs/tag-user.rc ; RUN: llvm-readobj %t/tag-user.res | FileCheck %s ; CHECK: Resource type (int): 500 diff --git a/test/tools/llvm-rc/tag-versioninfo.test b/test/tools/llvm-rc/tag-versioninfo.test index 4c30346f6b2..0118f3c109d 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 /FO %t -- %p/Inputs/tag-versioninfo.rc ; RUN: llvm-readobj %t | FileCheck %s ; CHECK: Resource type (int): 16 diff --git a/test/tools/llvm-rc/tokenizer.test b/test/tools/llvm-rc/tokenizer.test index 5103b190c31..59164677bac 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 /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 7cfb537b3ff..fab18a6dd92 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 /FO %t -- %p/Inputs/versioninfo-padding.rc ; RUN: llvm-readobj %t | FileCheck %s ; CHECK: Resource type (int): 16 diff --git a/tools/llvm-rc/llvm-rc.cpp b/tools/llvm-rc/llvm-rc.cpp index 4511c5c3128..54997e900a2 100644 --- a/tools/llvm-rc/llvm-rc.cpp +++ b/tools/llvm-rc/llvm-rc.cpp @@ -31,6 +31,7 @@ #include "llvm/Support/Signals.h" #include "llvm/Support/raw_ostream.h" +#include #include using namespace llvm; @@ -85,7 +86,10 @@ int main(int Argc, const char **Argv) { RcOptTable T; unsigned MAI, MAC; - ArrayRef ArgsArr = makeArrayRef(Argv + 1, Argc - 1); + const char **DashDash = std::find_if( + Argv + 1, Argv + Argc, [](StringRef Str) { return Str == "--"; }); + ArrayRef ArgsArr = makeArrayRef(Argv + 1, DashDash); + opt::InputArgList InputArgs = T.ParseArgs(ArgsArr, MAI, MAC); // The tool prints nothing when invoked with no command-line arguments. @@ -97,6 +101,8 @@ int main(int Argc, const char **Argv) { const bool BeVerbose = InputArgs.hasArg(OPT_VERBOSE); std::vector InArgsInfo = InputArgs.getAllArgValues(OPT_INPUT); + if (DashDash != Argv + Argc) + InArgsInfo.insert(InArgsInfo.end(), DashDash + 1, Argv + Argc); if (InArgsInfo.size() != 1) { fatalError("Exactly one input file should be provided."); }