From 6ead8c288e3691b8c579b092d07d7344eeb31701 Mon Sep 17 00:00:00 2001 From: kchristin Date: Fri, 22 Nov 2024 13:26:40 +0200 Subject: [PATCH] Set decl replacement as used and referenced in the code --- lib/Differentiator/StmtClone.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Differentiator/StmtClone.cpp b/lib/Differentiator/StmtClone.cpp index 81413ba95..e430d4f03 100644 --- a/lib/Differentiator/StmtClone.cpp +++ b/lib/Differentiator/StmtClone.cpp @@ -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); @@ -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())