Skip to content

Commit f3b6141

Browse files
authored
Remove the redundant SetIndependentVarCountDecl setter. NFC (#1897)
SetIndependentVarCountDecl existed only so VectorPushForwardModeVisitor could set the base's m_IndVarCountDecl. That member is protected, so a derived class assigns it directly; the setter is a needless indirection. Assign m_IndVarCountDecl at the one call site and drop the setter.
1 parent 02cd313 commit f3b6141

3 files changed

Lines changed: 1 addition & 7 deletions

File tree

include/clad/Differentiator/VectorForwardModeVisitor.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ class VectorForwardModeVisitor : public BaseForwardModeVisitor {
8484

8585
std::string GetPushForwardFunctionSuffix() override;
8686
DiffMode GetPushForwardMode() override;
87-
88-
void SetIndependentVarCountDecl(clang::VarDecl* VD);
8987
};
9088
} // end namespace clad
9189

lib/Differentiator/VectorForwardModeVisitor.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ DiffMode VectorForwardModeVisitor::GetPushForwardMode() {
2828
return DiffMode::vector_pushforward;
2929
}
3030

31-
void VectorForwardModeVisitor::SetIndependentVarCountDecl(VarDecl* VD) {
32-
m_IndVarCountDecl = VD;
33-
}
34-
3531
DerivativeAndOverload VectorForwardModeVisitor::Derive() {
3632
const FunctionDecl* FD = m_DiffReq.Function;
3733
assert(m_DiffReq.Mode == DiffMode::vector_forward_mode);

lib/Differentiator/VectorPushForwardModeVisitor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void VectorPushForwardModeVisitor::ExecuteInsidePushforwardFunctionBlock() {
4343
auto* totalIndVars =
4444
BuildVarDecl(m_Context.UnsignedLongTy, "indepVarCount", indVarCountExpr);
4545
addToCurrentBlock(BuildDeclStmt(totalIndVars));
46-
SetIndependentVarCountDecl(totalIndVars);
46+
m_IndVarCountDecl = totalIndVars;
4747

4848
BaseForwardModeVisitor::ExecuteInsidePushforwardFunctionBlock();
4949
}

0 commit comments

Comments
 (0)