diff options
Diffstat (limited to 'llvm/tools/llvm-rc/llvm-rc.cpp')
-rw-r--r-- | llvm/tools/llvm-rc/llvm-rc.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/tools/llvm-rc/llvm-rc.cpp b/llvm/tools/llvm-rc/llvm-rc.cpp index 4511c5c3128..54997e900a2 100644 --- a/llvm/tools/llvm-rc/llvm-rc.cpp +++ b/llvm/tools/llvm-rc/llvm-rc.cpp @@ -31,6 +31,7 @@ #include "llvm/Support/Signals.h" #include "llvm/Support/raw_ostream.h" +#include <algorithm> #include <system_error> using namespace llvm; @@ -85,7 +86,10 @@ int main(int Argc, const char **Argv) { RcOptTable T; unsigned MAI, MAC; - ArrayRef<const char *> ArgsArr = makeArrayRef(Argv + 1, Argc - 1); + const char **DashDash = std::find_if( + Argv + 1, Argv + Argc, [](StringRef Str) { return Str == "--"; }); + ArrayRef<const char *> 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<std::string> 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."); } |