@@ -1927,22 +1927,35 @@ void importer::addEntryToLookupTable(SwiftLookupTable &table,
19271927 // possible to find these decls during deserialization. For any C++ typedef
19281928 // that defines a name for a class template instantiation (e.g. std::string),
19291929 // import the mangled name of this instantiation, and add it to the table.
1930+ auto addTemplateSpecialization =
1931+ [&](clang::ClassTemplateSpecializationDecl *specializationDecl) {
1932+ auto name = nameImporter.importName (specializationDecl, currentVersion);
1933+
1934+ // Avoid adding duplicate entries into the table.
1935+ auto existingEntries =
1936+ table.lookup (DeclBaseName (name.getDeclName ().getBaseName ()),
1937+ name.getEffectiveContext ());
1938+ if (existingEntries.empty ()) {
1939+ table.addEntry (name.getDeclName (), specializationDecl,
1940+ name.getEffectiveContext ());
1941+ }
1942+ };
19301943 if (auto typedefNameDecl = dyn_cast<clang::TypedefNameDecl>(named)) {
19311944 auto underlyingDecl = typedefNameDecl->getUnderlyingType ()->getAsTagDecl ();
19321945
19331946 if (auto specializationDecl =
19341947 dyn_cast_or_null<clang::ClassTemplateSpecializationDecl>(
19351948 underlyingDecl)) {
1936- auto name = nameImporter. importName (specializationDecl, currentVersion );
1937-
1938- // Avoid adding duplicate entries into the table.
1939- auto existingEntries =
1940- table. lookup ( DeclBaseName (name. getDeclName (). getBaseName ()),
1941- name. getEffectiveContext ());
1942- if (existingEntries. empty ()) {
1943- table. addEntry (name. getDeclName (), specializationDecl,
1944- name. getEffectiveContext ());
1945- }
1949+ addTemplateSpecialization (specializationDecl);
1950+ }
1951+ }
1952+ if ( auto valueDecl = dyn_cast<clang::ValueDecl>(named)) {
1953+ auto valueTypeDecl = valueDecl-> getType ()-> getAsTagDecl ();
1954+
1955+ if (auto specializationDecl =
1956+ dyn_cast_or_null<clang::ClassTemplateSpecializationDecl>(
1957+ valueTypeDecl)) {
1958+ addTemplateSpecialization (specializationDecl);
19461959 }
19471960 }
19481961
0 commit comments