[PATCH] D13419: Fix several problems at the intersection of template instantiations and visibility
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 5 13:42:45 PDT 2015
rsmith added inline comments.
================
Comment at: lib/AST/Decl.cpp:1089
@@ -1086,10 +1088,3 @@
if (const FunctionDecl *fn = dyn_cast<FunctionDecl>(ND)) {
- // If the function is a specialization of a template with an
- // explicit visibility attribute, use that.
- if (FunctionTemplateSpecializationInfo *templateInfo
- = fn->getTemplateSpecializationInfo())
- return getVisibilityOf(templateInfo->getTemplate()->getTemplatedDecl(),
- kind);
-
- // If the function is a member of a specialization of a class template
+ // If the function is a member of a specialization of a some template
// and the corresponding decl has explicit visibility, use that.
----------------
typo "of a some"
================
Comment at: lib/AST/DeclCXX.cpp:1264-1269
@@ -1263,7 +1263,8 @@
if (auto *CTD = From.dyn_cast<ClassTemplateDecl *>()) {
- while (auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
+ auto *NewCTD = CTD;
+ do {
+ CTD = NewCTD;
if (NewCTD->isMemberSpecialization())
break;
- CTD = NewCTD;
- }
+ } while ((NewCTD = CTD->getInstantiatedFromMemberTemplate()));
return CTD->getTemplatedDecl()->getDefinition();
----------------
This loop structure is not very clear. How about:
while (!CTD->isMemberSpecialization()) {
auto *NewCTD = CTD->getInstantiatedFromMemberTemplate();
if (!NewCTD)
break;
CTD = NewCTD;
}
... or
while (auto *FromCTD = CTD->isMemberSpecialization()
? nullptr
: CTD->getInstantiatedFromMemberTemplate())
CTD = FromCTD;
Repository:
rL LLVM
http://reviews.llvm.org/D13419
More information about the cfe-commits
mailing list