Skip to content

Commit

Permalink
Fix PVD assignment using const_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristin22 committed Nov 17, 2024
1 parent 71582a4 commit 2eed07b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1894,11 +1894,8 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
const auto* PVD = FD->getParamDecl(
i - static_cast<unsigned long>(isMethodOperatorCall));
if (PVD->getType()->isRValueReferenceType()) {
IdentifierInfo* PVDII = PVD->getIdentifier();
IdentifierInfo* RValueName = CreateUniqueIdentifier("_r");
auto* param = CloneParmVarDecl(PVD, PVDII);
param->setDeclName(RValueName);
PVD = param;
const_cast<ParmVarDecl*>(PVD)->setDeclName(RValueName);
}
StmtDiff argDiff{};
// We do not need to create result arg for arguments passed by reference
Expand Down

0 comments on commit 2eed07b

Please sign in to comment.