[PATCH] D55820: [AST] Unify the code paths of traversing lambda expressions.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 18 07:23:53 PST 2018

ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM. The new code looks simpler and it's arguably simpler for the clients, since they'll have a consistent set of callbacks independent of the actual view into the lambda expression.

Comment at: include/clang/AST/RecursiveASTVisitor.h:2416
   FunctionProtoTypeLoc Proto = TL.getAsAdjusted<FunctionProtoTypeLoc>();
+  if (S->hasExplicitParameters()) {
hokein wrote:
> ilya-biryukov wrote:
> > Could we add a comment on why we can't simply call the `TraverseTypeLoc` here?
> > Something like:
> > 
> > ```
> > /// We manually deconstruct the TypeLoc for the lambda type to only
> > /// visit the parts of the type that were explicitly specified. 
> > /// We do not call the `TraverseTypeLoc` function to make sure we 
> > /// visit explicitly specified parts of the lambda even when shouldWalkTypeOfTypeLocs()
> > /// return false.
> > ```
> As discussed, this patch is just to simplify the code, this comment is not needed.
Thanks for clarifying, I had incorrect assumptions about the reasons for the original failure in the index library.

  rC Clang



More information about the cfe-commits mailing list