From 90d17a007d579e7cd352a696a45b86e5d653f258 Mon Sep 17 00:00:00 2001 From: Max Andriychuk Date: Fri, 1 Nov 2024 16:31:28 +0100 Subject: [PATCH] Don't mark constant parameters as varied --- lib/Differentiator/DiffPlanner.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/Differentiator/DiffPlanner.cpp b/lib/Differentiator/DiffPlanner.cpp index b4c7018a2..d501ac614 100644 --- a/lib/Differentiator/DiffPlanner.cpp +++ b/lib/Differentiator/DiffPlanner.cpp @@ -624,7 +624,19 @@ namespace clad { return true; if (!m_ActivityRunInfo.HasAnalysisRun) { - std::copy(Function->param_begin(), Function->param_end(), + ArrayRef FDparam = Function->parameters(); + std::vector derivedParam; + + for(auto* parameter: FDparam){ + QualType parType = parameter->getType(); + if(parType->isPointerType()){ + if(!parType->getPointeeType().isConstQualified()) + derivedParam.push_back(parameter); + }else if(!parType.isConstQualified()) + derivedParam.push_back(parameter); + } + + std::copy(derivedParam.begin(), derivedParam.end(), std::inserter(m_ActivityRunInfo.ToBeRecorded, m_ActivityRunInfo.ToBeRecorded.end()));