[SILParser] fix a few issues to enable parsing of sil from swift array

Add PrintForSIL in PrintOptions
1> for NameAliasType, we print getSinglyDesugaredType()
I attempted another option: set FullyQualifiedTypes of PrintOptions, but that
will print xxx.Type.xxx and Parser can’t handle it.
2> for Self, we print @sil_self

We also work around parsing:
sil_witness_table _CocoaArrayType: _CocoaArrayType

sil_vtable uses internal classes in stdlib, so we use lookupTopDecl instead
of lookupValue when parsing sil_vtable, to find internal classes.

Fix rdar://17261925 rdar://17295316 rdar://17046276 rdar://17579890


Swift SVN r20070
This commit is contained in:
Manman Ren
2014-07-17 04:43:24 +00:00
parent 61df8d7f1f
commit 1bd9d81971
13 changed files with 73 additions and 38 deletions

View File

@@ -1837,6 +1837,11 @@ public:
}
void visitNameAliasType(NameAliasType *T) {
if (Options.PrintForSIL) {
visit(T->getSinglyDesugaredType());
return;
}
if (shouldPrintFullyQualified(T)) {
if (auto ParentDC = T->getDecl()->getDeclContext()) {
printDeclContext(ParentDC);
@@ -2195,6 +2200,13 @@ public:
}
void visitArchetypeType(ArchetypeType *T) {
if (Options.PrintForSIL) {
if (auto proto = T->getSelfProtocol()) {
Printer << "@sil_self ";
visit(proto->getDeclaredType());
return;
}
}
if (auto existentialTy = T->getOpenedExistentialType()) {
Printer << "@opened(" << T->getOpenedExistentialID() << ") ";
visit(existentialTy);