mirror of
https://github.com/intel/llvm.git
synced 2026-01-22 23:49:22 +08:00
[clang][Driver] Rename "FatalError" key to "Error" in multilib.yaml (#110804)
This is a late-breaking change to #105684, suggested after the original patch was already landed.
This commit is contained in:
@@ -202,8 +202,8 @@ For a more comprehensive example see
|
||||
|
||||
# If there is no multilib available for a particular set of flags, and the
|
||||
# other multilibs are not adequate fallbacks, then you can define a variant
|
||||
# record with a FatalError key in place of the Dir key.
|
||||
- FatalError: this multilib collection has no hard-float ABI support
|
||||
# record with an Error key in place of the Dir key.
|
||||
- Error: this multilib collection has no hard-float ABI support
|
||||
Flags: [--target=thumbv7m-none-eabi, -mfloat-abi=hard]
|
||||
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ private:
|
||||
// Some Multilib objects don't actually represent library directories you can
|
||||
// select. Instead, they represent failures of multilib selection, of the
|
||||
// form 'Sorry, we don't have any library compatible with these constraints'.
|
||||
std::optional<std::string> FatalError;
|
||||
std::optional<std::string> Error;
|
||||
|
||||
public:
|
||||
/// GCCSuffix, OSSuffix & IncludeSuffix will be appended directly to the
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
Multilib(StringRef GCCSuffix = {}, StringRef OSSuffix = {},
|
||||
StringRef IncludeSuffix = {}, const flags_list &Flags = flags_list(),
|
||||
StringRef ExclusiveGroup = {},
|
||||
std::optional<StringRef> FatalError = std::nullopt);
|
||||
std::optional<StringRef> Error = std::nullopt);
|
||||
|
||||
/// Get the detected GCC installation path suffix for the multi-arch
|
||||
/// target variant. Always starts with a '/', unless empty
|
||||
@@ -94,9 +94,9 @@ public:
|
||||
|
||||
bool operator==(const Multilib &Other) const;
|
||||
|
||||
bool isFatalError() const { return FatalError.has_value(); }
|
||||
bool isError() const { return Error.has_value(); }
|
||||
|
||||
const std::string &getFatalError() const { return FatalError.value(); }
|
||||
const std::string &getErrorMessage() const { return Error.value(); }
|
||||
};
|
||||
|
||||
raw_ostream &operator<<(raw_ostream &OS, const Multilib &M);
|
||||
|
||||
@@ -2322,7 +2322,7 @@ bool Driver::HandleImmediateArgs(Compilation &C) {
|
||||
|
||||
if (C.getArgs().hasArg(options::OPT_print_multi_lib)) {
|
||||
for (const Multilib &Multilib : TC.getMultilibs())
|
||||
if (!Multilib.isFatalError())
|
||||
if (!Multilib.isError())
|
||||
llvm::outs() << Multilib << "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -32,10 +32,9 @@ using namespace llvm::sys;
|
||||
|
||||
Multilib::Multilib(StringRef GCCSuffix, StringRef OSSuffix,
|
||||
StringRef IncludeSuffix, const flags_list &Flags,
|
||||
StringRef ExclusiveGroup,
|
||||
std::optional<StringRef> FatalError)
|
||||
StringRef ExclusiveGroup, std::optional<StringRef> Error)
|
||||
: GCCSuffix(GCCSuffix), OSSuffix(OSSuffix), IncludeSuffix(IncludeSuffix),
|
||||
Flags(Flags), ExclusiveGroup(ExclusiveGroup), FatalError(FatalError) {
|
||||
Flags(Flags), ExclusiveGroup(ExclusiveGroup), Error(Error) {
|
||||
assert(GCCSuffix.empty() ||
|
||||
(StringRef(GCCSuffix).front() == '/' && GCCSuffix.size() > 1));
|
||||
assert(OSSuffix.empty() ||
|
||||
@@ -123,11 +122,11 @@ bool MultilibSet::select(const Driver &D, const Multilib::flags_list &Flags,
|
||||
continue;
|
||||
}
|
||||
|
||||
// If this multilib is actually a placeholder containing a fatal
|
||||
// error message written by the multilib.yaml author, display that
|
||||
// error message, and return failure.
|
||||
if (M.isFatalError()) {
|
||||
D.Diag(clang::diag::err_drv_multilib_custom_error) << M.getFatalError();
|
||||
// If this multilib is actually a placeholder containing an error message
|
||||
// written by the multilib.yaml author, display that error message, and
|
||||
// return failure.
|
||||
if (M.isError()) {
|
||||
D.Diag(clang::diag::err_drv_multilib_custom_error) << M.getErrorMessage();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -173,7 +172,7 @@ static const VersionTuple MultilibVersionCurrent(1, 0);
|
||||
|
||||
struct MultilibSerialization {
|
||||
std::string Dir; // if this record successfully selects a library dir
|
||||
std::string FatalError; // if this record reports a fatal error message
|
||||
std::string Error; // if this record reports a fatal error message
|
||||
std::vector<std::string> Flags;
|
||||
std::string Group;
|
||||
};
|
||||
@@ -217,15 +216,15 @@ struct MultilibSetSerialization {
|
||||
template <> struct llvm::yaml::MappingTraits<MultilibSerialization> {
|
||||
static void mapping(llvm::yaml::IO &io, MultilibSerialization &V) {
|
||||
io.mapOptional("Dir", V.Dir);
|
||||
io.mapOptional("FatalError", V.FatalError);
|
||||
io.mapOptional("Error", V.Error);
|
||||
io.mapRequired("Flags", V.Flags);
|
||||
io.mapOptional("Group", V.Group);
|
||||
}
|
||||
static std::string validate(IO &io, MultilibSerialization &V) {
|
||||
if (V.Dir.empty() && V.FatalError.empty())
|
||||
return "one of the 'Dir' and 'FatalError' keys must be specified";
|
||||
if (!V.Dir.empty() && !V.FatalError.empty())
|
||||
return "the 'Dir' and 'FatalError' keys may not both be specified";
|
||||
if (V.Dir.empty() && V.Error.empty())
|
||||
return "one of the 'Dir' and 'Error' keys must be specified";
|
||||
if (!V.Dir.empty() && !V.Error.empty())
|
||||
return "the 'Dir' and 'Error' keys may not both be specified";
|
||||
if (StringRef(V.Dir).starts_with("/"))
|
||||
return "paths must be relative but \"" + V.Dir + "\" starts with \"/\"";
|
||||
return std::string{};
|
||||
@@ -311,8 +310,8 @@ MultilibSet::parseYaml(llvm::MemoryBufferRef Input,
|
||||
multilib_list Multilibs;
|
||||
Multilibs.reserve(MS.Multilibs.size());
|
||||
for (const auto &M : MS.Multilibs) {
|
||||
if (!M.FatalError.empty()) {
|
||||
Multilibs.emplace_back("", "", "", M.Flags, M.Group, M.FatalError);
|
||||
if (!M.Error.empty()) {
|
||||
Multilibs.emplace_back("", "", "", M.Flags, M.Group, M.Error);
|
||||
} else {
|
||||
std::string Dir;
|
||||
if (M.Dir != ".")
|
||||
|
||||
@@ -201,7 +201,7 @@ static void findMultilibsFromYAML(const ToolChain &TC, const Driver &D,
|
||||
D.Diag(clang::diag::warn_drv_missing_multilib) << llvm::join(Flags, " ");
|
||||
std::stringstream ss;
|
||||
for (const Multilib &Multilib : Result.Multilibs)
|
||||
if (!Multilib.isFatalError())
|
||||
if (!Multilib.isError())
|
||||
ss << "\n" << llvm::join(Multilib.flags(), " ");
|
||||
D.Diag(clang::diag::note_drv_available_multilibs) << ss.str();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ Variants:
|
||||
Flags:
|
||||
- --target=thumbv8.1m.main-unknown-none-eabi
|
||||
|
||||
- FatalError: mve-softfloat is not supported
|
||||
- Error: mve-softfloat is not supported
|
||||
Flags:
|
||||
- --target=thumbv8.1m.main-unknown-none-eabi
|
||||
- -march=thumbv8.1m.main+mve
|
||||
|
||||
@@ -282,7 +282,7 @@ Variants:
|
||||
)"));
|
||||
EXPECT_TRUE(
|
||||
StringRef(Diagnostic)
|
||||
.contains("one of the 'Dir' and 'FatalError' keys must be specified"))
|
||||
.contains("one of the 'Dir' and 'Error' keys must be specified"))
|
||||
<< Diagnostic;
|
||||
|
||||
EXPECT_FALSE(parseYaml(MS, Diagnostic, YAML_PREAMBLE R"(
|
||||
|
||||
Reference in New Issue
Block a user