Skip to content

Commit 0fc6806

Browse files
committed
[CSOptimizer] NFC: Switch to llvm::Optional
1 parent da65333 commit 0fc6806

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 1 addition & 1 deletion
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-
Optional<std::pair<Constraint *, llvm::TinyPtrVector<Constraint *>>>
5217+
llvm::Optional<std::pair<Constraint *, llvm::TinyPtrVector<Constraint *>>>
52185218
selectDisjunction();
52195219

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

lib/Sema/CSOptimizer.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,8 @@ static void determineBestChoicesInContext(
170170
}
171171

172172
// Match arguments to the given overload choice.
173-
auto matchArguments =
174-
[&](OverloadChoice choice,
175-
FunctionType *overloadType) -> Optional<MatchCallArgumentResult> {
173+
auto matchArguments = [&](OverloadChoice choice, FunctionType *overloadType)
174+
-> llvm::Optional<MatchCallArgumentResult> {
176175
auto *decl = choice.getDeclOrNull();
177176
assert(decl);
178177

@@ -187,7 +186,7 @@ static void determineBestChoicesInContext(
187186
return matchCallArguments(argsWithLabels, overloadType->getParams(),
188187
paramListInfo,
189188
argumentList->getFirstTrailingClosureIndex(),
190-
/*allow fixes*/ false, listener, None);
189+
/*allow fixes*/ false, listener, llvm::None);
191190
};
192191

193192
// Determine whether the candidate type is a subclass of the superclass
@@ -634,13 +633,13 @@ selectBestBindingDisjunction(ConstraintSystem &cs,
634633
return firstBindDisjunction;
635634
}
636635

637-
Optional<std::pair<Constraint *, llvm::TinyPtrVector<Constraint *>>>
636+
llvm::Optional<std::pair<Constraint *, llvm::TinyPtrVector<Constraint *>>>
638637
ConstraintSystem::selectDisjunction() {
639638
SmallVector<Constraint *, 4> disjunctions;
640639

641640
collectDisjunctions(disjunctions);
642641
if (disjunctions.empty())
643-
return None;
642+
return llvm::None;
644643

645644
if (auto *disjunction = selectBestBindingDisjunction(*this, disjunctions))
646645
return std::make_pair(disjunction, llvm::TinyPtrVector<Constraint *>());
@@ -678,5 +677,5 @@ ConstraintSystem::selectDisjunction() {
678677
if (bestDisjunction != disjunctions.end())
679678
return std::make_pair(*bestDisjunction, favorings[*bestDisjunction]);
680679

681-
return None;
680+
return llvm::None;
682681
}

0 commit comments

Comments
 (0)