aboutsummaryrefslogtreecommitdiff
path: root/llvm
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2023-03-24 12:06:24 +0200
committerMartin Storsjö <martin@martin.st>2023-03-28 11:02:43 +0300
commitdc41f387e357d87117b29e0da9e741be6884287c (patch)
tree152d4a88e433a2cc49cfa7ebf61da5cebe288b91 /llvm
parent014e5c8d39c172a5b4bb1e1c75ced9bcb9ff2115 (diff)
downloadllvm-dc41f387e357d87117b29e0da9e741be6884287c.zip
llvm-dc41f387e357d87117b29e0da9e741be6884287c.tar.gz
llvm-dc41f387e357d87117b29e0da9e741be6884287c.tar.bz2
[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
Diffstat (limited to 'llvm')
-rw-r--r--llvm/tools/llvm-rc/llvm-rc.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/llvm/tools/llvm-rc/llvm-rc.cpp b/llvm/tools/llvm-rc/llvm-rc.cpp
index a8b838a..d77d68f 100644
--- a/llvm/tools/llvm-rc/llvm-rc.cpp
+++ b/llvm/tools/llvm-rc/llvm-rc.cpp
@@ -228,7 +228,7 @@ struct RcOptions {
unsigned LangId = (/*PrimaryLangId*/ 0x09) | (/*SubLangId*/ 0x01 << 10);
};
-bool preprocess(StringRef Src, StringRef Dst, const RcOptions &Opts,
+void preprocess(StringRef Src, StringRef Dst, const RcOptions &Opts,
const char *Argv0) {
std::string Clang;
if (Opts.PrintCmdAndExit || !Opts.PreprocessCmd.empty()) {
@@ -238,15 +238,12 @@ bool preprocess(StringRef Src, StringRef Dst, const RcOptions &Opts,
if (ClangOrErr) {
Clang = *ClangOrErr;
} else {
- errs() << "llvm-rc: Unable to find clang, skipping preprocessing."
+ errs() << "llvm-rc: Unable to find clang for preprocessing."
<< "\n";
StringRef OptionName =
Opts.IsWindres ? "--no-preprocess" : "-no-preprocess";
- errs()
- << "Pass " << OptionName
- << " to disable preprocessing. This will be an error in the future."
- << "\n";
- return false;
+ errs() << "Pass " << OptionName << " to disable preprocessing.\n";
+ fatalError("llvm-rc: Unable to preprocess.");
}
}
@@ -278,7 +275,6 @@ bool preprocess(StringRef Src, StringRef Dst, const RcOptions &Opts,
if (Res) {
fatalError("llvm-rc: Preprocessing failed.");
}
- return true;
}
static std::pair<bool, std::string> isWindres(llvm::StringRef Argv0) {
@@ -612,8 +608,8 @@ void doRc(std::string Src, std::string Dest, RcOptions &Opts,
if (Opts.Preprocess) {
std::string OutFile = createTempFile("preproc", "rc");
TempPreprocFile.setFile(OutFile);
- if (preprocess(Src, OutFile, Opts, Argv0))
- PreprocessedFile = OutFile;
+ preprocess(Src, OutFile, Opts, Argv0);
+ PreprocessedFile = OutFile;
}
// Read and tokenize the input file.