diff --git a/lib/Differentiator/BaseForwardModeVisitor.cpp b/lib/Differentiator/BaseForwardModeVisitor.cpp index 075656c35..f93daee7d 100644 --- a/lib/Differentiator/BaseForwardModeVisitor.cpp +++ b/lib/Differentiator/BaseForwardModeVisitor.cpp @@ -163,6 +163,8 @@ BaseForwardModeVisitor::Derive(const FunctionDecl* FD, // Check if the function is already declared as a custom derivative. std::string gradientName = request.BaseFunctionName + "_d" + s + "arg" + argInfo + derivativeSuffix; + // FIXME: We should not use const_cast to get the decl context here. + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) auto* DC = const_cast(m_DiffReq->getDeclContext()); if (FunctionDecl* customDerivative = m_Builder.LookupCustomDerivativeDecl(gradientName, DC, FD->getType())) diff --git a/lib/Differentiator/HessianModeVisitor.cpp b/lib/Differentiator/HessianModeVisitor.cpp index 6d4b2982f..3bcdfa51b 100644 --- a/lib/Differentiator/HessianModeVisitor.cpp +++ b/lib/Differentiator/HessianModeVisitor.cpp @@ -127,6 +127,8 @@ static FunctionDecl* DeriveUsingForwardAndReverseMode( originalFnProtoType->getExtProtoInfo()); // Check if the function is already declared as a custom derivative. + // FIXME: We should not use const_cast to get the decl context here. + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) auto* DC = const_cast(m_DiffReq->getDeclContext()); if (FunctionDecl* customDerivative = m_Builder.LookupCustomDerivativeDecl( hessianFuncName, DC, hessianFunctionType)) diff --git a/lib/Differentiator/ReverseModeVisitor.cpp b/lib/Differentiator/ReverseModeVisitor.cpp index 22dac863b..10483f51a 100644 --- a/lib/Differentiator/ReverseModeVisitor.cpp +++ b/lib/Differentiator/ReverseModeVisitor.cpp @@ -362,6 +362,8 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context, originalFnType->getExtProtoInfo()); // Check if the function is already declared as a custom derivative. + // FIXME: We should not use const_cast to get the decl context here. + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) auto* DC = const_cast(m_DiffReq->getDeclContext()); if (FunctionDecl* customDerivative = m_Builder.LookupCustomDerivativeDecl( gradientName, DC, gradientFunctionType)) {