[PATCH] D24969: [Sema] Use the instantiated name of destructors in FindInstantiatedDecl and RebuildMemberExpr

Richard Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 20 11:18:34 PST 2016


rsmith added a comment.

Looks good, other than error recovery.



================
Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:4851
+      DeclarationNameInfo NameInfo(Name, D->getLocation());
+      Name = SubstDeclarationNameInfo(NameInfo, TemplateArgs).getName();
+      DeclContext::lookup_result Found = ParentDC->lookup(Name);
----------------
You should deal with the possibility of `SubstDeclarationNameInfo` failing (which will happen if substitution into the name creates an invalid type). If you get a null name back from the `Subst` call, just return null.


================
Comment at: lib/Sema/TreeTransform.h:8766-8767
   NamedDecl *FirstQualifierInScope = nullptr;
+  DeclarationNameInfo MemberNameInfo =
+      getDerived().TransformDeclarationNameInfo(E->getMemberNameInfo());
 
----------------
Likewise here, you should return `ExprError()` if the transformed name is null (please also add an assert that the name is not null before the transform, as in that case a null transformed name would not indicate an error has been diagnosed).


https://reviews.llvm.org/D24969





More information about the cfe-commits mailing list