diff --git a/llvm/tools/llvm-rc/llvm-rc.cpp b/llvm/tools/llvm-rc/llvm-rc.cpp --- a/llvm/tools/llvm-rc/llvm-rc.cpp +++ b/llvm/tools/llvm-rc/llvm-rc.cpp @@ -227,7 +227,7 @@ bool preprocess(StringRef Src, StringRef Dst, const RcOptions &Opts, const char *Argv0) { std::string Clang; - if (Opts.PrintCmdAndExit) { + if (Opts.PrintCmdAndExit || !Opts.PreprocessCmd.empty()) { Clang = "clang"; } else { ErrorOr ClangOrErr = findClang(Argv0, Opts.Triple); @@ -267,7 +267,7 @@ } // The llvm Support classes don't handle reading from stdout of a child // process; otherwise we could avoid using a temp file. - int Res = sys::ExecuteAndWait(Clang, Args); + int Res = sys::ExecuteAndWait(Args[0], Args); if (Res) { fatalError("llvm-rc: Preprocessing failed."); }