@@ -3911,7 +3911,8 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
3911
3911
}
3912
3912
}
3913
3913
3914
- void printFunctionExtInfo (SILFunctionType::ExtInfo info,
3914
+ void printFunctionExtInfo (ASTContext &Ctx,
3915
+ SILFunctionType::ExtInfo info,
3915
3916
ProtocolConformanceRef witnessMethodConformance) {
3916
3917
if (Options.SkipAttributes )
3917
3918
return ;
@@ -3925,10 +3926,19 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
3925
3926
}
3926
3927
}
3927
3928
3928
- if ((Options.PrintFunctionRepresentationAttrs !=
3929
- PrintOptions::FunctionRepresentationMode::None) &&
3930
- !Options.excludeAttrKind (TAK_convention) &&
3931
- info.getRepresentation () != SILFunctionType::Representation::Thick) {
3929
+
3930
+ SmallString<64 > buf;
3931
+ switch (Options.PrintFunctionRepresentationAttrs ) {
3932
+ case PrintOptions::FunctionRepresentationMode::None:
3933
+ break ;
3934
+ case PrintOptions::FunctionRepresentationMode::NameOnly:
3935
+ case PrintOptions::FunctionRepresentationMode::Full:
3936
+ if (Options.excludeAttrKind (TAK_convention) ||
3937
+ info.getRepresentation () == SILFunctionType::Representation::Thick)
3938
+ break ;
3939
+
3940
+ bool printNameOnly = Options.PrintFunctionRepresentationAttrs ==
3941
+ PrintOptions::FunctionRepresentationMode::NameOnly;
3932
3942
Printer.callPrintStructurePre (PrintStructureKind::BuiltinAttribute);
3933
3943
Printer.printAttrName (" @convention" );
3934
3944
Printer << " (" ;
@@ -3943,6 +3953,11 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
3943
3953
break ;
3944
3954
case SILFunctionType::Representation::CFunctionPointer:
3945
3955
Printer << " c" ;
3956
+ // FIXME: [clang-function-type-serialization] Once we start serializing
3957
+ // Clang function types, we should be able to remove the second check.
3958
+ if (printNameOnly || !info.getUncommonInfo ().hasValue ())
3959
+ break ;
3960
+ printCType (Ctx, Printer, info);
3946
3961
break ;
3947
3962
case SILFunctionType::Representation::Method:
3948
3963
Printer << " method" ;
@@ -4102,7 +4117,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
4102
4117
4103
4118
void visitSILFunctionType (SILFunctionType *T) {
4104
4119
printSILCoroutineKind (T->getCoroutineKind ());
4105
- printFunctionExtInfo (T->getExtInfo (),
4120
+ printFunctionExtInfo (T->getASTContext (), T-> getExtInfo (),
4106
4121
T->getWitnessMethodConformanceOrInvalid ());
4107
4122
printCalleeConvention (T->getCalleeConvention ());
4108
4123
0 commit comments