diff --git a/include/clad/Differentiator/DiffPlanner.h b/include/clad/Differentiator/DiffPlanner.h index ef29b7246..388757ca4 100644 --- a/include/clad/Differentiator/DiffPlanner.h +++ b/include/clad/Differentiator/DiffPlanner.h @@ -169,13 +169,13 @@ struct DiffRequest { // Define the hash function for DiffRequest. template <> struct std::hash { - std::size_t operator()(const clad::DiffRequest& DR) const { - // Use the function pointer as the hash of the DiffRequest, it - // is sufficient to break a reasonable number of collisions. - if (DR.Function->getPreviousDecl()) - return std::hash{}(DR.Function->getPreviousDecl()); - return std::hash{}(DR.Function); - } + std::size_t operator()(const clad::DiffRequest& DR) const { + // Use the function pointer as the hash of the DiffRequest, it + // is sufficient to break a reasonable number of collisions. + if (DR.Function->getPreviousDecl()) + return std::hash{}(DR.Function->getPreviousDecl()); + return std::hash{}(DR.Function); + } }; #endif diff --git a/include/clad/Differentiator/Differentiator.h b/include/clad/Differentiator/Differentiator.h index 2518dcd91..169ec2e77 100644 --- a/include/clad/Differentiator/Differentiator.h +++ b/include/clad/Differentiator/Differentiator.h @@ -164,8 +164,8 @@ CUDA_HOST_DEVICE T push(tape& to, ArgsT... val) { typename std::enable_if::type = true> CUDA_HOST_DEVICE auto execute_with_default_args(list, ReturnType C::*f, Obj&& obj, - list, Args&&... args) - -> return_type_t { + list, + Args&&... args) -> return_type_t { return (static_cast(obj).*f)((fArgTypes)(args)..., static_cast(nullptr)...); } @@ -174,8 +174,8 @@ CUDA_HOST_DEVICE T push(tape& to, ArgsT... val) { class Obj, class... Args, class... fArgTypes, typename std::enable_if::type = true> auto execute_with_default_args(list, ReturnType C::*f, Obj&& obj, - list, Args&&... args) - -> return_type_t { + list, + Args&&... args) -> return_type_t { return (static_cast(obj).*f)(static_cast(args)...); } @@ -366,7 +366,8 @@ CUDA_HOST_DEVICE T push(tape& to, ArgsT... val) { execute_helper(ReturnType C::*f, Obj&& obj, Args&&... args) { // `static_cast` is required here for perfect forwarding. return execute_with_default_args( - DropArgs_t{}, f, static_cast(obj), + DropArgs_t{}, f, + static_cast(obj), TakeNFirstArgs_t{}, static_cast(args)...); } diff --git a/include/clad/Differentiator/FunctionTraits.h b/include/clad/Differentiator/FunctionTraits.h index c15eeb270..9ae855371 100644 --- a/include/clad/Differentiator/FunctionTraits.h +++ b/include/clad/Differentiator/FunctionTraits.h @@ -656,10 +656,10 @@ namespace clad { /// qualifier only if it is supported and finally AddSPECS declares the /// function with all the cases #define HessianDerivedFnTraits_AddSPECS(var, cv, vol, ref, noex) \ - template \ - struct HessianDerivedFnTraits { \ - using type = void (C::*)(Args..., R*) cv vol ref noex; \ - }; + template \ + struct HessianDerivedFnTraits { \ + using type = void (C::*)(Args..., R*) cv vol ref noex; \ + }; #if __cpp_noexcept_function_type > 0 #define HessianDerivedFnTraits_AddNOEX(var, con, vol, ref) \ diff --git a/lib/Differentiator/DiffPlanner.cpp b/lib/Differentiator/DiffPlanner.cpp index e25cabf40..8b5cd2df2 100644 --- a/lib/Differentiator/DiffPlanner.cpp +++ b/lib/Differentiator/DiffPlanner.cpp @@ -304,12 +304,11 @@ namespace clad { i < e && paramIdx < FD->getNumParams(); ++i) { const auto* param = DVI[i].param; while (paramIdx < FD->getNumParams() && - FD->getParamDecl(paramIdx) != param) { - ++paramIdx; - } + FD->getParamDecl(paramIdx) != param) + ++paramIdx; if (paramIdx != FD->getNumParams()) - // Update the parameter to point to the definition parameter. - DVI[i].param = Function->getParamDecl(paramIdx); + // Update the parameter to point to the definition parameter. + DVI[i].param = Function->getParamDecl(paramIdx); } return; }