mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[serialization] Look past one typealias when looking for a nominal decl.
This is a hack to handle "typedef struct CGRect CGRect", but obviously it isn’t going to work in the general case. Filed <rdar://problem/14526923> to undo this later. Swift SVN r6526
This commit is contained in:
@@ -1554,6 +1554,12 @@ Type ModuleFile::getType(TypeID TID) {
|
||||
// Record the type as soon as possible. Members of a nominal type often
|
||||
// try to refer back to the type.
|
||||
getDecl(declID, Nothing, makeStackLambda([&](Decl *D) {
|
||||
// FIXME: Hack for "typedef struct CGRect CGRect". In the long run we need
|
||||
// something less brittle that would also handle pointer typedefs and
|
||||
// typedefs that just /happen/ to match a tagged name but don't actually
|
||||
// point to the tagged type.
|
||||
if (auto alias = dyn_cast<TypeAliasDecl>(D))
|
||||
D = alias->getUnderlyingType()->getAnyNominal();
|
||||
auto nominal = cast<NominalTypeDecl>(D);
|
||||
typeOrOffset = NominalType::get(nominal, parentTy, ctx);
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user