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

@@ -212,7 +212,7 @@ public:
DiagnosticEngine &getDiags(SourceLoc Loc = SourceLoc());
void addDiagConsumer(DiagnosticConsumer &Consumer);
void setCommonVersion(uint8_t Ver) {
assert(!CommonVersion.hasValue());
assert(!CommonVersion.has_value());
CommonVersion = Ver;
}
uint8_t getCommonVersion() const {
@@ -401,7 +401,7 @@ public:
StringRef getGenericSignature() const { return GenericSig; }
StringRef getSugaredGenericSignature() const { return SugaredGenericSig; }
StringRef getScreenInfo() const;
bool hasFixedBinaryOrder() const { return FixedBinaryOrder.hasValue(); }
bool hasFixedBinaryOrder() const { return FixedBinaryOrder.has_value(); }
uint8_t getFixedBinaryOrder() const { return *FixedBinaryOrder; }
PlatformIntroVersion getIntroducingVersion() const { return introVersions; }
StringRef getObjCName() const { return ObjCName; }
@@ -685,9 +685,9 @@ protected:
public:
bool isThrowing() const { return IsThrowing; }
bool reqNewWitnessTableEntry() const { return ReqNewWitnessTableEntry; }
uint8_t getSelfIndex() const { return SelfIndex.getValue(); }
uint8_t getSelfIndex() const { return SelfIndex.value(); }
Optional<uint8_t> getSelfIndexOptional() const { return SelfIndex; }
bool hasSelfIndex() const { return SelfIndex.hasValue(); }
bool hasSelfIndex() const { return SelfIndex.has_value(); }
static bool classof(const SDKNode *N);
virtual void jsonize(json::Output &out) override;
static StringRef getTypeRoleDescription(SDKContext &Ctx, unsigned Index);