Skip to content

Commit

Permalink
Set decl replacement as used and referenced in the code
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristin22 committed Nov 22, 2024
1 parent 23bbfdc commit 4184bf5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Differentiator/StmtClone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,8 @@ bool ReferencesUpdater::VisitDeclRefExpr(DeclRefExpr* DRE) {
auto it = m_DeclReplacements.find(VD);
if (it != std::end(m_DeclReplacements)) {
DRE->setDecl(it->second);
DRE->getDecl()->setReferenced();
DRE->getDecl()->setIsUsed();
QualType NonRefQT = it->second->getType().getNonReferenceType();
if (NonRefQT != DRE->getType())
DRE->setType(NonRefQT);
Expand All @@ -552,7 +554,7 @@ bool ReferencesUpdater::VisitDeclRefExpr(DeclRefExpr* DRE) {
// FIXME: Handle the case when there are overloads found. Update
// it with the best match.
//
// FIXME: This is the right way to go in principe, however there is no
// FIXME: This is the right way to go in principle, however there is no
// properly built decl context.
// m_Sema.MarkDeclRefReferenced(clonedDRE);
if (!R.isSingleResult())
Expand Down

0 comments on commit 4184bf5

Please sign in to comment.