use new llvm::Optional API

`getValue` -> `value`
`getValueOr` -> `value_or`
`hasValue` -> `has_value`
`map` -> `transform`

The old API will be deprecated in the rebranch.
To avoid merge conflicts, use the new API already in the main branch.

rdar://102362022
This commit is contained in:
Erik Eckstein
2022-11-15 15:08:30 +01:00
parent 567b68aa6f
commit ab1b343dad
328 changed files with 1537 additions and 1536 deletions

View File

@@ -107,7 +107,7 @@ SDKNode::SDKNode(SDKNodeInitInfo Info, SDKNodeKind Kind): Ctx(Info.Ctx),
SDKNodeRoot::SDKNodeRoot(SDKNodeInitInfo Info): SDKNode(Info, SDKNodeKind::Root),
ToolArgs(Info.ToolArgs),
JsonFormatVer(Info.JsonFormatVer.hasValue() ? *Info.JsonFormatVer : DIGESTER_JSON_DEFAULT_VERSION) {}
JsonFormatVer(Info.JsonFormatVer.has_value() ? *Info.JsonFormatVer : DIGESTER_JSON_DEFAULT_VERSION) {}
SDKNodeDecl::SDKNodeDecl(SDKNodeInitInfo Info, SDKNodeKind Kind)
: SDKNode(Info, Kind), DKind(Info.DKind), Usr(Info.Usr),
@@ -1347,7 +1347,7 @@ StringRef SDKContext::getLanguageIntroVersion(Decl *D) {
StringRef SDKContext::getObjcName(Decl *D) {
if (auto *OC = D->getAttrs().getAttribute<ObjCAttr>()) {
if (OC->getName().hasValue()) {
if (OC->getName().has_value()) {
SmallString<32> Buffer;
return buffer(OC->getName()->getString(Buffer));
}
@@ -1710,7 +1710,7 @@ SDKContext::shouldIgnore(Decl *D, const Decl* Parent) const {
if (auto *VD = dyn_cast<ValueDecl>(D)) {
// Private vars with fixed binary orders can have ABI-impact, so we should
// allowlist them if we're checking ABI.
if (getFixedBinaryOrder(VD).hasValue())
if (getFixedBinaryOrder(VD).has_value())
return false;
// Typealias should have no impact on ABI.
if (isa<TypeAliasDecl>(VD))
@@ -2692,7 +2692,7 @@ void swift::ide::api::SDKNodeDeclAbstractFunc::diagnose(SDKNode *Right) {
break;
}
auto result = isFromExtensionChanged(*this, *Right);
if (result.hasValue() && *result) {
if (result.has_value() && *result) {
emitDiag(Loc, diag::class_member_moved_to_extension);
}
break;