r369999 - Don't lose the FoundDecl and template arguments for a DeclRefExpr in
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 26 18:06:21 PDT 2019
Author: rsmith
Date: Mon Aug 26 18:06:21 2019
New Revision: 369999
URL: http://llvm.org/viewvc/llvm-project?rev=369999&view=rev
Log:
Don't lose the FoundDecl and template arguments for a DeclRefExpr in
TreeTransform.
Modified:
cfe/trunk/lib/Sema/TreeTransform.h
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=369999&r1=369998&r2=369999&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Mon Aug 26 18:06:21 2019
@@ -2167,13 +2167,12 @@ public:
ExprResult RebuildDeclRefExpr(NestedNameSpecifierLoc QualifierLoc,
ValueDecl *VD,
const DeclarationNameInfo &NameInfo,
+ NamedDecl *Found,
TemplateArgumentListInfo *TemplateArgs) {
CXXScopeSpec SS;
SS.Adopt(QualifierLoc);
-
- // FIXME: loses template args.
-
- return getSema().BuildDeclarationNameExpr(SS, NameInfo, VD);
+ return getSema().BuildDeclarationNameExpr(SS, NameInfo, VD, Found,
+ TemplateArgs);
}
/// Build a new expression in parentheses.
@@ -9204,6 +9203,14 @@ TreeTransform<Derived>::TransformDeclRef
if (!ND)
return ExprError();
+ NamedDecl *Found = ND;
+ if (E->getFoundDecl() != E->getDecl()) {
+ Found = cast_or_null<NamedDecl>(
+ getDerived().TransformDecl(E->getLocation(), E->getFoundDecl()));
+ if (!Found)
+ return ExprError();
+ }
+
DeclarationNameInfo NameInfo = E->getNameInfo();
if (NameInfo.getName()) {
NameInfo = getDerived().TransformDeclarationNameInfo(NameInfo);
@@ -9236,7 +9243,7 @@ TreeTransform<Derived>::TransformDeclRef
}
return getDerived().RebuildDeclRefExpr(QualifierLoc, ND, NameInfo,
- TemplateArgs);
+ Found, TemplateArgs);
}
template<typename Derived>
More information about the cfe-commits
mailing list