[PATCH] D55437: [Index] Index declarations in lambda expression.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 18 06:36:07 PST 2018

hokein added a comment.

In D55437#1333145 <https://reviews.llvm.org/D55437#1333145>, @ilya-biryukov wrote:

> Update after investigating with @hokein offline: the `RecursiveASTVisitor` has custom code to visit lambda parameters and return type, but it fallback to visiting typelocs when both parameters and a return type are specified. Unfortunately this fallback does not work when `shouldWalkTypeLocs()` is set to false, which is the case for our visitor out here.
>  It seems reasonable to always visit parameters and return type, rather than relying on traversing the full type-loc of the lamda's function type.

Thanks! After taking a look at the code closely, it turns out `VisitTypeLoc` callback gets called when `shouldWalkTypeOfTypeLocs` is set to false, `shouldWalkTypeOfTypeLocs` just controls whether we visit the **type** itself, **type loc** is always visited.

Unifying code paths of `RecursiveASTVisitor` seems fine to me, and also simplifies the code of client side, separated in D55820 <https://reviews.llvm.org/D55820>.

  rC Clang



More information about the cfe-commits mailing list