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

@@ -699,9 +699,9 @@ void swift::ide::printModuleInterface(
if (!GroupNames.empty()){
if (auto TargetGroup = D->getGroupName()) {
if (std::find(GroupNames.begin(), GroupNames.end(),
TargetGroup.getValue()) != GroupNames.end()) {
TargetGroup.value()) != GroupNames.end()) {
FileRangedDecls.insert({
D->getSourceFileName().getValue(),
D->getSourceFileName().value(),
std::vector<Decl*>()
}).first->getValue().push_back(D);
}
@@ -718,10 +718,10 @@ void swift::ide::printModuleInterface(
auto &DeclsInFile = Entry.getValue();
std::sort(DeclsInFile.begin(), DeclsInFile.end(),
[](Decl* LHS, Decl *RHS) {
assert(LHS->getSourceOrder().hasValue());
assert(RHS->getSourceOrder().hasValue());
return LHS->getSourceOrder().getValue() <
RHS->getSourceOrder().getValue();
assert(LHS->getSourceOrder().has_value());
assert(RHS->getSourceOrder().has_value());
return LHS->getSourceOrder().value() <
RHS->getSourceOrder().value();
});
for (auto D : DeclsInFile) {
@@ -839,7 +839,7 @@ static SourceLoc getDeclStartPosition(SourceFile &File) {
}
static void printUntilFirstDeclStarts(SourceFile &File, ASTPrinter &Printer) {
if (!File.getBufferID().hasValue())
if (!File.getBufferID().has_value())
return;
auto BufferID = *File.getBufferID();