[PATCH] D36527: Implemented P0428R2 - Familiar template syntax for generic lambdas
Faisal Vali via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 25 04:11:06 PDT 2017
faisalv added inline comments.
================
Comment at: lib/AST/ExprCXX.cpp:979
+SourceRange LambdaExpr::getExplicitTemplateParameterListRange() const {
+ TemplateParameterList *List = getTemplateParameterList();
----------------
I think this should return an invalid range if getExplicitCount is 0.
might assert that when not 0, langleloc does not equal rangleloc.
================
Comment at: lib/Sema/SemaLambda.cpp:486
+ && "Already acted on explicit template parameters");
+ assert(LSI->TemplateParams.size() == 0
+ && "Explicit template parameters should come "
----------------
Perhaps also assert TParams.size should not be 0?
================
Comment at: lib/Sema/SemaLambda.cpp:495
+ reinterpret_cast<NamedDecl *const *>(TParams.begin()),
+ reinterpret_cast<NamedDecl *const *>(TParams.end()));
+ LSI->NumExplicitTemplateParams = TParams.size();
----------------
ack - avoid reinterpret cast please - why not just stick to Decl* for TemplateParams for now - and add some fixme's that suggest we should consider refactoring ParseTemplateParameterList to accept a vector of nameddecls - and update this when that gets updated ?
Perhaps add an assert here that iterates through and checks to make sure each item in this list is some form of a template parameter decl - within an #ifndef NDEBUG block (or your conversion check to NameDecl should suffice?)
https://reviews.llvm.org/D36527
More information about the cfe-commits
mailing list