@@ -921,10 +921,10 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
921
921
}
922
922
923
923
// SWIFT_ENABLE_TENSORFLOW
924
- case DAK_Differentiating : {
925
- Printer.printAttrName (" @differentiating " );
926
- Printer << ' ( ' ;
927
- auto *attr = cast<DifferentiatingAttr >(this );
924
+ case DAK_Derivative : {
925
+ Printer.printAttrName (" @derivative " );
926
+ Printer << " (of: " ;
927
+ auto *attr = cast<DerivativeAttr >(this );
928
928
auto *derivative = cast<AbstractFunctionDecl>(D);
929
929
Printer << attr->getOriginalFunctionName ().Name ;
930
930
auto diffParamsString = getDifferentiationParametersClauseString (
@@ -934,7 +934,7 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
934
934
Printer << ' )' ;
935
935
break ;
936
936
}
937
-
937
+
938
938
// SWIFT_ENABLE_TENSORFLOW
939
939
case DAK_Transposing: {
940
940
Printer.printAttrName (" @transposing" );
@@ -1108,6 +1108,8 @@ StringRef DeclAttribute::getAttrName() const {
1108
1108
// SWIFT_ENABLE_TENSORFLOW
1109
1109
case DAK_Differentiable:
1110
1110
return " differentiable" ;
1111
+ case DAK_Derivative:
1112
+ return " derivative" ;
1111
1113
case DAK_Differentiating:
1112
1114
return " differentiating" ;
1113
1115
case DAK_Transposing:
@@ -1568,43 +1570,42 @@ void DifferentiableAttr::print(llvm::raw_ostream &OS, const Decl *D,
1568
1570
}
1569
1571
1570
1572
// SWIFT_ENABLE_TENSORFLOW
1571
- DifferentiatingAttr::DifferentiatingAttr (
1572
- bool implicit, SourceLoc atLoc, SourceRange baseRange,
1573
- DeclNameWithLoc originalName, ArrayRef<ParsedAutoDiffParameter> params)
1574
- : DeclAttribute(DAK_Differentiating, atLoc, baseRange, implicit),
1573
+ DerivativeAttr::DerivativeAttr (bool implicit, SourceLoc atLoc,
1574
+ SourceRange baseRange,
1575
+ DeclNameWithLoc originalName,
1576
+ ArrayRef<ParsedAutoDiffParameter> params)
1577
+ : DeclAttribute(DAK_Derivative, atLoc, baseRange, implicit),
1575
1578
OriginalFunctionName(std::move(originalName)),
1576
1579
NumParsedParameters(params.size()) {
1577
1580
std::copy (params.begin (), params.end (),
1578
1581
getTrailingObjects<ParsedAutoDiffParameter>());
1579
1582
}
1580
1583
1581
- DifferentiatingAttr::DifferentiatingAttr (bool implicit, SourceLoc atLoc,
1582
- SourceRange baseRange,
1583
- DeclNameWithLoc originalName,
1584
- IndexSubset *indices)
1585
- : DeclAttribute(DAK_Differentiating , atLoc, baseRange, implicit),
1584
+ DerivativeAttr::DerivativeAttr (bool implicit, SourceLoc atLoc,
1585
+ SourceRange baseRange,
1586
+ DeclNameWithLoc originalName,
1587
+ IndexSubset *indices)
1588
+ : DeclAttribute(DAK_Derivative , atLoc, baseRange, implicit),
1586
1589
OriginalFunctionName(std::move(originalName)), ParameterIndices(indices) {
1587
1590
}
1588
1591
1589
- DifferentiatingAttr *
1590
- DifferentiatingAttr ::create (ASTContext &context, bool implicit, SourceLoc atLoc,
1591
- SourceRange baseRange, DeclNameWithLoc original ,
1592
- ArrayRef<ParsedAutoDiffParameter> params) {
1592
+ DerivativeAttr *
1593
+ DerivativeAttr ::create (ASTContext &context, bool implicit, SourceLoc atLoc,
1594
+ SourceRange baseRange, DeclNameWithLoc originalName ,
1595
+ ArrayRef<ParsedAutoDiffParameter> params) {
1593
1596
unsigned size = totalSizeToAlloc<ParsedAutoDiffParameter>(params.size ());
1594
- void *mem = context.Allocate (size, alignof (DifferentiatingAttr));
1595
- return new (mem) DifferentiatingAttr (implicit, atLoc, baseRange,
1596
- std::move (original), params);
1597
- }
1598
-
1599
- DifferentiatingAttr *DifferentiatingAttr::create (ASTContext &context,
1600
- bool implicit, SourceLoc atLoc,
1601
- SourceRange baseRange,
1602
- DeclNameWithLoc original,
1603
- IndexSubset *indices) {
1604
- void *mem = context.Allocate (sizeof (DifferentiatingAttr),
1605
- alignof (DifferentiatingAttr));
1606
- return new (mem) DifferentiatingAttr (implicit, atLoc, baseRange,
1607
- std::move (original), indices);
1597
+ void *mem = context.Allocate (size, alignof (DerivativeAttr));
1598
+ return new (mem) DerivativeAttr (implicit, atLoc, baseRange,
1599
+ std::move (originalName), params);
1600
+ }
1601
+
1602
+ DerivativeAttr *DerivativeAttr::create (ASTContext &context, bool implicit,
1603
+ SourceLoc atLoc, SourceRange baseRange,
1604
+ DeclNameWithLoc originalName,
1605
+ IndexSubset *indices) {
1606
+ void *mem = context.Allocate (sizeof (DerivativeAttr), alignof (DerivativeAttr));
1607
+ return new (mem) DerivativeAttr (implicit, atLoc, baseRange,
1608
+ std::move (originalName), indices);
1608
1609
}
1609
1610
1610
1611
TransposingAttr::TransposingAttr (bool implicit, SourceLoc atLoc,
0 commit comments