18
18
#include " swift/AST/ASTPrinter.h"
19
19
#include " swift/AST/ASTVisitor.h"
20
20
#include " swift/AST/Attr.h"
21
+ #include " swift/AST/AutoDiff.h"
21
22
#include " swift/AST/ClangModuleLoader.h"
22
23
#include " swift/AST/ForeignAsyncConvention.h"
23
24
#include " swift/AST/ForeignErrorConvention.h"
@@ -5024,7 +5025,7 @@ namespace {
5024
5025
}
5025
5026
5026
5027
void printAnyFunctionTypeCommonRec (AnyFunctionType *T, StringRef label,
5027
- StringRef name) {
5028
+ StringRef name) {
5028
5029
printCommon (name, label);
5029
5030
5030
5031
if (T->hasExtInfo ()) {
@@ -5039,6 +5040,24 @@ namespace {
5039
5040
printFlag (T->isAsync (), " async" );
5040
5041
printFlag (T->isThrowing (), " throws" );
5041
5042
printFlag (T->hasSendingResult (), " sending_result" );
5043
+ if (T->isDifferentiable ()) {
5044
+ switch (T->getDifferentiabilityKind ()) {
5045
+ default :
5046
+ llvm_unreachable (" unexpected differentiability kind" );
5047
+ case DifferentiabilityKind::Reverse:
5048
+ printFlag (" @differentiable(reverse)" );
5049
+ break ;
5050
+ case DifferentiabilityKind::Forward:
5051
+ printFlag (" @differentiable(_forward)" );
5052
+ break ;
5053
+ case DifferentiabilityKind::Linear:
5054
+ printFlag (" @differentiable(_linear)" );
5055
+ break ;
5056
+ case DifferentiabilityKind::Normal:
5057
+ printFlag (" @differentiable" );
5058
+ break ;
5059
+ }
5060
+ }
5042
5061
}
5043
5062
if (Type globalActor = T->getGlobalActor ()) {
5044
5063
printFieldQuoted (globalActor.getString (), " global_actor" );
0 commit comments