[PATCH] D16478: Always build a new TypeSourceInfo for function templates with parameters
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 1 14:14:01 PST 2016
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: lib/Sema/SemaTemplateInstantiate.cpp:1525-1530
@@ -1524,18 +1524,8 @@
for (unsigned I = 0, E = FP.getNumParams(); I != E; ++I) {
- ParmVarDecl *P = FP.getParam(I);
-
// This must be synthesized from a typedef.
- if (!P) continue;
-
- // The parameter's type as written might be dependent even if the
- // decayed type was not dependent.
- if (TypeSourceInfo *TSInfo = P->getTypeSourceInfo())
- if (TSInfo->getType()->isInstantiationDependentType())
- return true;
+ if (!FP.getParam(I)) continue;
- // TODO: currently we always rebuild expressions. When we
- // properly get lazier about this, we should use the same
- // logic to avoid rebuilding prototypes here.
- if (P->hasDefaultArg())
- return true;
+ // If there are any parameters, a new TypeSourceInfo that refers to the
+ // instantiated parameters must be built.
+ return true;
}
----------------
Maybe replace the whole loop with
for (ParmVarDecl *D : FP.getParmArray())
if (D)
return true;
(or an STL algorithm for same)?
http://reviews.llvm.org/D16478
More information about the cfe-commits
mailing list