Skip to content

Commit 54bdad6

Browse files
authored
[AutoDiff] Use TransposingAttr::getParameterIndices. (#27918)
Rename `TransposingAttr::getParameterIndexSubset` to `getParameterIndices`, for consistency with `DifferentiableAttr` and `DifferentiatingAttr`.
1 parent 1862c95 commit 54bdad6

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

include/swift/AST/Attr.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,7 @@ class TransposingAttr final
17611761
/// The number of parsed parameters specified in 'wrt:'.
17621762
unsigned NumParsedParameters = 0;
17631763
/// The differentiation parameters' indices, resolved by the type checker.
1764-
IndexSubset *ParameterIndexSubset = nullptr;
1764+
IndexSubset *ParameterIndices = nullptr;
17651765

17661766
explicit TransposingAttr(ASTContext &context, bool implicit,
17671767
SourceLoc atLoc, SourceRange baseRange,
@@ -1802,11 +1802,11 @@ class TransposingAttr final
18021802
return NumParsedParameters;
18031803
}
18041804

1805-
IndexSubset *getParameterIndexSubset() const {
1806-
return ParameterIndexSubset;
1805+
IndexSubset *getParameterIndices() const {
1806+
return ParameterIndices;
18071807
}
18081808
void setParameterIndices(IndexSubset *pi) {
1809-
ParameterIndexSubset = pi;
1809+
ParameterIndices = pi;
18101810
}
18111811

18121812
static bool classof(const DeclAttribute *DA) {

lib/AST/Attr.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -932,8 +932,7 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
932932
auto *transpose = dyn_cast_or_null<AbstractFunctionDecl>(D);
933933
Printer << attr->getOriginal().Name;
934934
auto diffParamsString = getTransposingParametersClauseString(
935-
transpose, attr->getParameterIndexSubset(),
936-
attr->getParsedParameters());
935+
transpose, attr->getParameterIndices(), attr->getParsedParameters());
937936
if (!diffParamsString.empty())
938937
Printer << ", " << diffParamsString;
939938
Printer << ')';
@@ -1584,7 +1583,7 @@ TransposingAttr::TransposingAttr(ASTContext &context, bool implicit,
15841583
IndexSubset *indices)
15851584
: DeclAttribute(DAK_Transposing, atLoc, baseRange, implicit),
15861585
BaseType(baseType), Original(std::move(original)),
1587-
ParameterIndexSubset(indices) {}
1586+
ParameterIndices(indices) {}
15881587

15891588
TransposingAttr *
15901589
TransposingAttr::create(ASTContext &context, bool implicit, SourceLoc atLoc,

lib/Sema/TypeCheckAttr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3920,7 +3920,7 @@ void AttributeChecker::visitTransposingAttr(TransposingAttr *attr) {
39203920
->castTo<AnyFunctionType>();
39213921

39223922
// Get checked wrt param indices.
3923-
auto *wrtParamIndices = attr->getParameterIndexSubset();
3923+
auto *wrtParamIndices = attr->getParameterIndices();
39243924

39253925
// Get the parsed wrt param indices, which have not yet been checked.
39263926
// This is defined for parsed attributes.

0 commit comments

Comments
 (0)