Skip to content

Commit 9b5b265

Browse files
committed
Take TypeInfoProvider into account when caching TypeInfos.
1 parent 9287707 commit 9b5b265

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

include/swift/Reflection/TypeLowering.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@ class ReferenceTypeInfo : public TypeInfo {
317317
class TypeConverter {
318318
TypeRefBuilder &Builder;
319319
std::vector<std::unique_ptr<const TypeInfo>> Pool;
320-
llvm::DenseMap<const TypeRef *, const TypeInfo *> Cache;
320+
llvm::DenseMap<std::pair<const TypeRef *, remote::TypeInfoProvider *>,
321+
const TypeInfo *> Cache;
321322
llvm::DenseSet<const TypeRef *> RecursionCheck;
322323
llvm::DenseMap<std::pair<unsigned, unsigned>,
323324
const ReferenceTypeInfo *> ReferenceCache;

lib/AST/ASTDemangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Type ASTBuilder::createNominalType(GenericTypeDecl *decl, Type parent) {
144144
return Type();
145145

146146
// If the declaration is generic, fail.
147-
if (nominalDecl->getGenericParams())
147+
if (auto list = nominalDecl->getGenericParams())
148148
return Type();
149149

150150
// Imported types can be renamed to be members of other (non-generic)

stdlib/public/Reflection/TypeLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,7 +2194,7 @@ const TypeInfo *
21942194
TypeConverter::getTypeInfo(const TypeRef *TR,
21952195
remote::TypeInfoProvider *ExternalTypeInfo) {
21962196
// See if we already computed the result
2197-
auto found = Cache.find(TR);
2197+
auto found = Cache.find({TR, ExternalTypeInfo});
21982198
if (found != Cache.end())
21992199
return found->second;
22002200

@@ -2207,7 +2207,7 @@ TypeConverter::getTypeInfo(const TypeRef *TR,
22072207

22082208
// Compute the result and cache it
22092209
auto *TI = LowerType(*this, ExternalTypeInfo).visit(TR);
2210-
Cache[TR] = TI;
2210+
Cache.insert({{TR, ExternalTypeInfo}, TI});
22112211

22122212
RecursionCheck.erase(TR);
22132213

0 commit comments

Comments
 (0)