@@ -4845,8 +4845,7 @@ CompilerType SwiftASTContext::GetAnyObjectType() {
4845
4845
return ToCompilerType ({ast->getAnyObjectType ()});
4846
4846
}
4847
4847
4848
- static CompilerType ValueDeclToType (swift::ValueDecl *decl,
4849
- swift::ASTContext *ast) {
4848
+ static CompilerType ValueDeclToType (swift::ValueDecl *decl) {
4850
4849
if (decl) {
4851
4850
switch (decl->getKind ()) {
4852
4851
case swift::DeclKind::TypeAlias: {
@@ -4875,15 +4874,14 @@ static CompilerType ValueDeclToType(swift::ValueDecl *decl,
4875
4874
return CompilerType ();
4876
4875
}
4877
4876
4878
- static CompilerType DeclToType (swift::Decl *decl, swift::ASTContext *ast ) {
4877
+ static CompilerType DeclToType (swift::Decl *decl) {
4879
4878
if (swift::ValueDecl *value_decl =
4880
4879
swift::dyn_cast_or_null<swift::ValueDecl>(decl))
4881
- return ValueDeclToType (value_decl, ast );
4880
+ return ValueDeclToType (value_decl);
4882
4881
return {};
4883
4882
}
4884
4883
4885
- static SwiftASTContext::TypeOrDecl DeclToTypeOrDecl (swift::ASTContext *ast,
4886
- swift::Decl *decl) {
4884
+ static SwiftASTContext::TypeOrDecl DeclToTypeOrDecl (swift::Decl *decl) {
4887
4885
if (decl) {
4888
4886
switch (decl->getKind ()) {
4889
4887
case swift::DeclKind::BuiltinTuple:
@@ -4963,12 +4961,10 @@ SwiftASTContext::FindContainedTypeOrDecl(llvm::StringRef name,
4963
4961
4964
4962
CompilerType container_type = container_type_or_decl.Apply <CompilerType>(
4965
4963
[](CompilerType type) -> CompilerType { return type; },
4966
- [this ](swift::Decl *decl) -> CompilerType {
4967
- ThreadSafeASTContext ast_ctx = GetASTContext ();
4968
- return DeclToType (decl, *ast_ctx);
4964
+ [](swift::Decl *decl) -> CompilerType {
4965
+ return DeclToType (decl);
4969
4966
});
4970
4967
4971
- ThreadSafeASTContext ast_ctx = GetASTContext ();
4972
4968
if (!name.empty () &&
4973
4969
container_type.GetTypeSystem ().isa_and_nonnull <TypeSystemSwift>()) {
4974
4970
swift::Type swift_type = GetSwiftTypeIgnoringErrors (container_type);
@@ -4983,7 +4979,7 @@ SwiftASTContext::FindContainedTypeOrDecl(llvm::StringRef name,
4983
4979
llvm::ArrayRef<swift::ValueDecl *> decls = nominal_decl->lookupDirect (
4984
4980
swift::DeclName (m_ast_context_ap->getIdentifier (name)));
4985
4981
for (auto *decl : decls)
4986
- results.emplace (DeclToTypeOrDecl (*ast_ctx, decl));
4982
+ results.emplace (DeclToTypeOrDecl (decl));
4987
4983
}
4988
4984
return results.size () - size_before;
4989
4985
}
@@ -5060,7 +5056,6 @@ size_t SwiftASTContext::FindTypesOrDecls(const char *name,
5060
5056
5061
5057
size_t before = results.size ();
5062
5058
5063
- ThreadSafeASTContext ast_ctx = GetASTContext ();
5064
5059
if (name && name[0 ] && swift_module) {
5065
5060
llvm::SmallVector<swift::ValueDecl *, 4 > value_decls;
5066
5061
swift::Identifier identifier (GetIdentifier (llvm::StringRef (name)));
@@ -5072,19 +5067,19 @@ size_t SwiftASTContext::FindTypesOrDecls(const char *name,
5072
5067
value_decls);
5073
5068
if (identifier.isOperator ()) {
5074
5069
if (auto *op = swift_module->lookupPrefixOperator (identifier))
5075
- results.emplace (DeclToTypeOrDecl (*ast_ctx, op));
5070
+ results.emplace (DeclToTypeOrDecl (op));
5076
5071
5077
5072
if (auto *op = swift_module->lookupInfixOperator (identifier).getSingle ())
5078
- results.emplace (DeclToTypeOrDecl (*ast_ctx, op));
5073
+ results.emplace (DeclToTypeOrDecl (op));
5079
5074
5080
5075
if (auto *op = swift_module->lookupPostfixOperator (identifier))
5081
- results.emplace (DeclToTypeOrDecl (*ast_ctx, op));
5076
+ results.emplace (DeclToTypeOrDecl (op));
5082
5077
}
5083
5078
if (auto *pg = swift_module->lookupPrecedenceGroup (identifier).getSingle ())
5084
- results.emplace (DeclToTypeOrDecl (*ast_ctx, pg));
5079
+ results.emplace (DeclToTypeOrDecl (pg));
5085
5080
5086
5081
for (auto *decl : value_decls)
5087
- results.emplace (DeclToTypeOrDecl (*ast_ctx, decl));
5082
+ results.emplace (DeclToTypeOrDecl (decl));
5088
5083
}
5089
5084
5090
5085
return results.size () - before;
0 commit comments