Skip to content

Commit dfa207b

Browse files
committed
Use std::function to fix unsafe use of llvm::function_ref.
This was exposed by building with a recent version of clang. Without this change, the following tests were failing: Swift(macosx-x86_64) :: IDE/complete_assignment.swift Swift(macosx-x86_64) :: IDE/complete_enum_elements.swift Swift(macosx-x86_64) :: IDE/complete_stmt_controlling_expr.swift Swift(macosx-x86_64) :: SourceKit/CodeComplete/complete_structure.swift I did not narrow it down to which uses of DeclFilter were problematic. The global variables certainly do not seem like a good place to use a function_ref. rdar://problem/28699882
1 parent 198cb09 commit dfa207b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/IDE/CodeCompletion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ static bool shouldHideDeclFromCompletionResults(const ValueDecl *D) {
302302
return false;
303303
}
304304

305-
typedef llvm::function_ref<bool(ValueDecl*, DeclVisibilityKind)> DeclFilter;
305+
typedef std::function<bool(ValueDecl*, DeclVisibilityKind)> DeclFilter;
306306
DeclFilter DefaultFilter = [] (ValueDecl* VD, DeclVisibilityKind Kind) {return true;};
307307
DeclFilter KeyPathFilter = [](ValueDecl* decl, DeclVisibilityKind) -> bool {
308308
return isa<TypeDecl>(decl) ||

0 commit comments

Comments
 (0)