[llvm] Use std::nullopt instead of None (NFC)

I've verified that every change in this patch affects generated files
and would reduce the number of warnings if None were deprecated.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
This commit is contained in:
Kazu Hirata 2022-12-04 13:52:42 -08:00
parent f4c16c4473
commit a38cfc50fc
6 changed files with 10 additions and 10 deletions

View File

@ -496,7 +496,7 @@ void MarkupFilter::printValue(Twine Value) {
#define ASSIGN_OR_RETURN_NONE(TYPE, NAME, EXPR) \
auto NAME##Opt = (EXPR); \
if (!NAME##Opt) \
return None; \
return std::nullopt; \
TYPE NAME = std::move(*NAME##Opt)
Optional<MarkupFilter::Module>

View File

@ -31,7 +31,7 @@ using namespace llvm;
TY res = *NAME##View; \
return res; \
} \
return None; \
return std::nullopt; \
}
MCOPT_EXP(bool, RelaxAll)

View File

@ -3947,7 +3947,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
OS << " MII.getDeprecatedInfo(Inst, getSTI(), Info)) {\n";
OS << " SMLoc Loc = ((" << Target.getName()
<< "Operand &)*Operands[0]).getStartLoc();\n";
OS << " getParser().Warning(Loc, Info, None);\n";
OS << " getParser().Warning(Loc, Info, std::nullopt);\n";
OS << " }\n";
}

View File

@ -647,7 +647,7 @@ void GICombinerEmitter::emitNameMatcher(raw_ostream &OS) const {
StringMatcher Matcher("RuleIdentifier", Cases, OS);
Matcher.Emit();
OS << "#endif // ifndef NDEBUG\n\n"
<< " return None;\n"
<< " return std::nullopt;\n"
<< "}\n";
}
@ -960,7 +960,7 @@ void GICombinerEmitter::run(raw_ostream &OS) {
<< " const auto Last = "
"getRuleIdxForIdentifier(RangePair.second);\n"
<< " if (!First || !Last)\n"
<< " return None;\n"
<< " return std::nullopt;\n"
<< " if (First >= Last)\n"
<< " report_fatal_error(\"Beginning of range should be before "
"end of range\");\n"
@ -971,7 +971,7 @@ void GICombinerEmitter::run(raw_ostream &OS) {
<< " }\n"
<< " const auto I = getRuleIdxForIdentifier(RangePair.first);\n"
<< " if (!I)\n"
<< " return None;\n"
<< " return std::nullopt;\n"
<< " return {{*I, *I + 1}};\n"
<< "}\n\n";

View File

@ -1690,7 +1690,7 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target,
OS << " };\n";
OS << " return makeArrayRef(Masks);\n";
} else {
OS << " return None;\n";
OS << " return std::nullopt;\n";
}
OS << "}\n\n";
@ -1756,7 +1756,7 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target,
OS << " };\n";
OS << " return makeArrayRef(Names);\n";
} else {
OS << " return None;\n";
OS << " return std::nullopt;\n";
}
OS << "}\n\n";

View File

@ -1862,7 +1862,7 @@ void SubtargetEmitter::run(raw_ostream &OS) {
if (NumFeatures)
OS << Target << "FeatureKV, ";
else
OS << "None, ";
OS << "std::nullopt, ";
if (NumProcs)
OS << Target << "SubTypeKV, ";
else
@ -1955,7 +1955,7 @@ void SubtargetEmitter::run(raw_ostream &OS) {
if (NumFeatures)
OS << "makeArrayRef(" << Target << "FeatureKV, " << NumFeatures << "), ";
else
OS << "None, ";
OS << "std::nullopt, ";
if (NumProcs)
OS << "makeArrayRef(" << Target << "SubTypeKV, " << NumProcs << "), ";
else