Skip to content

Commit 9726704

Browse files
committed
[ASTGen] Remove unused cache for types
1 parent 0264687 commit 9726704

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

include/swift/Parse/ASTGen.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ class ASTGen {
3737

3838
// FIXME: remove when Syntax can represent all types and ASTGen can handle
3939
// them
40-
/// Types that cannot be represented by Syntax or generated by ASTGen.
41-
llvm::DenseMap<SourceLoc, TypeRepr *> Types;
42-
40+
/// Decl attributes that cannot be represented by Syntax or generated by
41+
/// ASTGen.
4342
llvm::DenseMap<SourceLoc, DeclAttributes> ParsedDeclAttrs;
4443

4544
public:
@@ -205,10 +204,6 @@ class ASTGen {
205204
TypeRepr *lookupType(syntax::TypeSyntax Type);
206205

207206
public:
208-
void addType(TypeRepr *Type, const SourceLoc Loc);
209-
bool hasType(const SourceLoc Loc) const;
210-
TypeRepr *getType(const SourceLoc Loc) const;
211-
212207
void addDeclAttributes(DeclAttributes attrs, const SourceLoc Loc);
213208
bool hasDeclAttributes(SourceLoc Loc) const;
214209
DeclAttributes getDeclAttributes(const SourceLoc Loc) const;

lib/Parse/ASTGen.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,6 @@ TypeRepr *ASTGen::generate(const TypeSyntax &Type, const SourceLoc Loc,
265265
else if (auto Unknown = Type.getAs<UnknownTypeSyntax>())
266266
TypeAST = generate(*Unknown, Loc);
267267

268-
// todo [gsoc]: handle InheritedTypeSyntax & ClassRestrictionTypeSyntax?
269-
270-
if (!TypeAST && hasType(advanceLocBegin(Loc, Type)))
271-
TypeAST = getType(advanceLocBegin(Loc, Type));
272-
273268
return cacheType(Type, TypeAST);
274269
}
275270

@@ -1065,18 +1060,6 @@ TypeRepr *ASTGen::lookupType(TypeSyntax Type) {
10651060
return Found != TypeCache.end() ? Found->second : nullptr;
10661061
}
10671062

1068-
void ASTGen::addType(TypeRepr *Type, const SourceLoc Loc) {
1069-
Types.insert({Loc, Type});
1070-
}
1071-
1072-
bool ASTGen::hasType(const SourceLoc Loc) const {
1073-
return Types.find(Loc) != Types.end();
1074-
}
1075-
1076-
TypeRepr *ASTGen::getType(const SourceLoc Loc) const {
1077-
return Types.find(Loc)->second;
1078-
}
1079-
10801063
void ASTGen::addDeclAttributes(DeclAttributes attrs, SourceLoc Loc) {
10811064
ParsedDeclAttrs.insert({Loc, attrs});
10821065
}

0 commit comments

Comments
 (0)