Skip to content

Commit dc41f38

Browse files
committed
[llvm-rc] Remove transitional preprocessing fallback logic
When preprocessing was integrated to llvm-rc in 2021, this was a new requirement (previously one could execute llvm-rc without a suitable preprocessing tool to be available). As a transitional helper, llvm-rc fell back on skipping preprocessing if no suitable tool was found (with a warning printed), but users could pass an llvm-rc specific option to silence the warning, if they explicitly want to run the tool without preprocessing. Now 2 years later, remove the transitional helper - error out if preprocessing failed. The option for disabling preprocessing remains. Differential Revision: https://reviews.llvm.org/D146797
1 parent 014e5c8 commit dc41f38

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

llvm/tools/llvm-rc/llvm-rc.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ struct RcOptions {
228228
unsigned LangId = (/*PrimaryLangId*/ 0x09) | (/*SubLangId*/ 0x01 << 10);
229229
};
230230

231-
bool preprocess(StringRef Src, StringRef Dst, const RcOptions &Opts,
231+
void preprocess(StringRef Src, StringRef Dst, const RcOptions &Opts,
232232
const char *Argv0) {
233233
std::string Clang;
234234
if (Opts.PrintCmdAndExit || !Opts.PreprocessCmd.empty()) {
@@ -238,15 +238,12 @@ bool preprocess(StringRef Src, StringRef Dst, const RcOptions &Opts,
238238
if (ClangOrErr) {
239239
Clang = *ClangOrErr;
240240
} else {
241-
errs() << "llvm-rc: Unable to find clang, skipping preprocessing."
241+
errs() << "llvm-rc: Unable to find clang for preprocessing."
242242
<< "\n";
243243
StringRef OptionName =
244244
Opts.IsWindres ? "--no-preprocess" : "-no-preprocess";
245-
errs()
246-
<< "Pass " << OptionName
247-
<< " to disable preprocessing. This will be an error in the future."
248-
<< "\n";
249-
return false;
245+
errs() << "Pass " << OptionName << " to disable preprocessing.\n";
246+
fatalError("llvm-rc: Unable to preprocess.");
250247
}
251248
}
252249

@@ -278,7 +275,6 @@ bool preprocess(StringRef Src, StringRef Dst, const RcOptions &Opts,
278275
if (Res) {
279276
fatalError("llvm-rc: Preprocessing failed.");
280277
}
281-
return true;
282278
}
283279

284280
static std::pair<bool, std::string> isWindres(llvm::StringRef Argv0) {
@@ -612,8 +608,8 @@ void doRc(std::string Src, std::string Dest, RcOptions &Opts,
612608
if (Opts.Preprocess) {
613609
std::string OutFile = createTempFile("preproc", "rc");
614610
TempPreprocFile.setFile(OutFile);
615-
if (preprocess(Src, OutFile, Opts, Argv0))
616-
PreprocessedFile = OutFile;
611+
preprocess(Src, OutFile, Opts, Argv0);
612+
PreprocessedFile = OutFile;
617613
}
618614

619615
// Read and tokenize the input file.

0 commit comments

Comments
 (0)