Skip to content

Commit 401b7c4

Browse files
committed
[Sema] std::function -> llvm::function_ref for some non-escaping params.
1 parent d4fbca1 commit 401b7c4

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

lib/Sema/TypeCheckNameLookup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
using namespace swift;
2828

2929
void LookupResult::filter(
30-
const std::function<bool(LookupResultEntry, bool)> &pred) {
30+
llvm::function_ref<bool(LookupResultEntry, bool)> pred) {
3131
size_t index = 0;
3232
size_t originalFirstOuter = IndexOfFirstOuterResult;
3333
Results.erase(std::remove_if(Results.begin(), Results.end(),

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,14 @@ RequirementMatch
351351
swift::matchWitness(
352352
TypeChecker &tc,
353353
DeclContext *dc, ValueDecl *req, ValueDecl *witness,
354-
const std::function<
354+
llvm::function_ref<
355355
std::tuple<Optional<RequirementMatch>, Type, Type>(void)>
356-
&setup,
357-
const std::function<Optional<RequirementMatch>(Type, Type)>
358-
&matchTypes,
359-
const std::function<
356+
setup,
357+
llvm::function_ref<Optional<RequirementMatch>(Type, Type)>
358+
matchTypes,
359+
llvm::function_ref<
360360
RequirementMatch(bool, ArrayRef<OptionalAdjustment>)
361-
> &finalize) {
361+
> finalize) {
362362
assert(!req->isInvalid() && "Cannot have an invalid requirement here");
363363

364364
/// Make sure the witness is of the same kind as the requirement.

lib/Sema/TypeCheckProtocol.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -830,14 +830,14 @@ class AssociatedTypeInference {
830830
RequirementMatch matchWitness(
831831
TypeChecker &tc,
832832
DeclContext *dc, ValueDecl *req, ValueDecl *witness,
833-
const std::function<
833+
llvm::function_ref<
834834
std::tuple<Optional<RequirementMatch>, Type, Type>(void)>
835-
&setup,
836-
const std::function<Optional<RequirementMatch>(Type, Type)>
837-
&matchTypes,
838-
const std::function<
835+
setup,
836+
llvm::function_ref<Optional<RequirementMatch>(Type, Type)>
837+
matchTypes,
838+
llvm::function_ref<
839839
RequirementMatch(bool, ArrayRef<OptionalAdjustment>)
840-
> &finalize);
840+
> finalize);
841841

842842
RequirementMatch matchWitness(TypeChecker &tc,
843843
ProtocolDecl *proto,

lib/Sema/TypeChecker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class LookupResult {
148148

149149
/// Filter out any results that aren't accepted by the given predicate.
150150
void
151-
filter(const std::function<bool(LookupResultEntry, /*isOuter*/ bool)> &pred);
151+
filter(llvm::function_ref<bool(LookupResultEntry, /*isOuter*/ bool)> pred);
152152
};
153153

154154
/// The result of name lookup for types.

0 commit comments

Comments
 (0)