Skip to content

Commit

Permalink
Don't mark constant parameters as varied
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Andriychuk committed Nov 1, 2024
1 parent 6c45be3 commit 90d17a0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/Differentiator/DiffPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,19 @@ namespace clad {
return true;

if (!m_ActivityRunInfo.HasAnalysisRun) {
std::copy(Function->param_begin(), Function->param_end(),
ArrayRef<ParmVarDecl*> FDparam = Function->parameters();
std::vector<ParmVarDecl*> 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()));

Expand Down

0 comments on commit 90d17a0

Please sign in to comment.