Skip to content

Commit 8955cdc

Browse files
committed
[SourceKit] Add decl.var.type tags in property declarations
These Type::print can just reuse the printTypeLoc logic even if they don't have a TypeRepr. rdar://problem/24292226
1 parent da77ba5 commit 8955cdc

File tree

6 files changed

+65
-76
lines changed

6 files changed

+65
-76
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -786,19 +786,9 @@ void PrintAST::printAttributes(const Decl *D) {
786786
}
787787

788788
void PrintAST::printTypedPattern(const TypedPattern *TP) {
789-
auto TheTypeLoc = TP->getTypeLoc();
790-
if (TheTypeLoc.hasLocation()) {
791-
792-
printPattern(TP->getSubPattern());
793-
Printer << ": ";
794-
printTypeLoc(TheTypeLoc);
795-
return;
796-
}
797-
798-
799789
printPattern(TP->getSubPattern());
800790
Printer << ": ";
801-
TP->getType().print(Printer, Options);
791+
printTypeLoc(TP->getTypeLoc());
802792
}
803793

804794
void PrintAST::printPattern(const Pattern *pattern) {
@@ -1878,11 +1868,8 @@ void PrintAST::visitVarDecl(VarDecl *decl) {
18781868
});
18791869
if (decl->hasType()) {
18801870
Printer << ": ";
1881-
if (Options.TransformContext)
1882-
Options.TransformContext->transform(decl->getType()).
1883-
print(Printer, Options);
1884-
else
1885-
decl->getType().print(Printer, Options);
1871+
// Use the non-repr external type, but reuse the TypeLoc printing code.
1872+
printTypeLoc(TypeLoc::withoutLoc(decl->getType()));
18861873
}
18871874

18881875
printAccessors(decl);

0 commit comments

Comments
 (0)