Skip to content

Commit 34edb25

Browse files
committed
Swift: mangle TypeAliasDecls differently
1 parent 9876c39 commit 34edb25

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

swift/extractor/visitors/DeclVisitor.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,14 @@ std::string DeclVisitor::mangledName(const swift::ValueDecl& decl) {
296296
if (decl.getKind() == swift::DeclKind::Module) {
297297
return static_cast<const swift::ModuleDecl&>(decl).getRealName().str().str();
298298
}
299+
// In cases like this (when coming from PCM)
300+
// typealias CFXMLTree = CFTree
301+
// typealias CFXMLTreeRef = CFXMLTree
302+
// mangleAnyDecl mangles both CFXMLTree and CFXMLTreeRef into 'So12CFXMLTreeRefa'
303+
// which is not correct and causes inconsistencies. mangleEntity makes these two distinct
304+
if (decl.getKind() == swift::DeclKind::TypeAlias) {
305+
return mangler.mangleEntity(&decl);
306+
}
299307
// prefix adds a couple of special symbols, we don't necessary need them
300308
return mangler.mangleAnyDecl(&decl, /* prefix = */ false);
301309
}

0 commit comments

Comments
 (0)