Skip to content

Commit c429f5b

Browse files
committed
[CSOptimizer] NFC: Switch from llvm::Optional to std::optional post-rebase
1 parent 2869dff commit c429f5b

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

include/swift/Sema/ConstraintSystem.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5214,7 +5214,7 @@ class ConstraintSystem {
52145214
/// Pick a disjunction from the InactiveConstraints list.
52155215
///
52165216
/// \returns The selected disjunction and a set of it's favored choices.
5217-
llvm::Optional<std::pair<Constraint *, llvm::TinyPtrVector<Constraint *>>>
5217+
std::optional<std::pair<Constraint *, llvm::TinyPtrVector<Constraint *>>>
52185218
selectDisjunction();
52195219

52205220
/// Pick a conjunction from the InactiveConstraints list.

lib/Sema/CSOptimizer.cpp

+10-11
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static void determineBestChoicesInContext(
171171

172172
// Match arguments to the given overload choice.
173173
auto matchArguments = [&](OverloadChoice choice, FunctionType *overloadType)
174-
-> llvm::Optional<MatchCallArgumentResult> {
174+
-> std::optional<MatchCallArgumentResult> {
175175
auto *decl = choice.getDeclOrNull();
176176
assert(decl);
177177

@@ -186,7 +186,7 @@ static void determineBestChoicesInContext(
186186
return matchCallArguments(argsWithLabels, overloadType->getParams(),
187187
paramListInfo,
188188
argumentList->getFirstTrailingClosureIndex(),
189-
/*allow fixes*/ false, listener, llvm::None);
189+
/*allow fixes*/ false, listener, std::nullopt);
190190
};
191191

192192
// Determine whether the candidate type is a subclass of the superclass
@@ -209,15 +209,14 @@ static void determineBestChoicesInContext(
209209
return false;
210210

211211
return llvm::all_of(layout.getProtocols(), [&](ProtocolDecl *P) {
212-
if (auto superclass = P->getSuperclass()) {
213-
if (!isSubclassOf(candidateType, superclass))
212+
if (auto superclass = P->getSuperclassDecl()) {
213+
if (!isSubclassOf(candidateType,
214+
superclass->getDeclaredInterfaceType()))
214215
return false;
215216
}
216217

217-
return bool(TypeChecker::containsProtocol(
218-
candidateType, P, cs.DC->getParentModule(),
219-
/*skipConditionalRequirements=*/true,
220-
/*allowMissing=*/false));
218+
return bool(TypeChecker::containsProtocol(candidateType, P,
219+
/*allowMissing=*/false));
221220
});
222221
}
223222

@@ -639,13 +638,13 @@ selectBestBindingDisjunction(ConstraintSystem &cs,
639638
return firstBindDisjunction;
640639
}
641640

642-
llvm::Optional<std::pair<Constraint *, llvm::TinyPtrVector<Constraint *>>>
641+
std::optional<std::pair<Constraint *, llvm::TinyPtrVector<Constraint *>>>
643642
ConstraintSystem::selectDisjunction() {
644643
SmallVector<Constraint *, 4> disjunctions;
645644

646645
collectDisjunctions(disjunctions);
647646
if (disjunctions.empty())
648-
return llvm::None;
647+
return std::nullopt;
649648

650649
if (auto *disjunction = selectBestBindingDisjunction(*this, disjunctions))
651650
return std::make_pair(disjunction, llvm::TinyPtrVector<Constraint *>());
@@ -683,5 +682,5 @@ ConstraintSystem::selectDisjunction() {
683682
if (bestDisjunction != disjunctions.end())
684683
return std::make_pair(*bestDisjunction, favorings[*bestDisjunction]);
685684

686-
return llvm::None;
685+
return std::nullopt;
687686
}

0 commit comments

Comments
 (0)