[clangd-dev] Strange issue with RecursiveASTVisitor, TestTU, and variable templates
Ilya Biryukov via clangd-dev
clangd-dev at lists.llvm.org
Tue Apr 23 01:00:09 PDT 2019
I agree that looks weird, behavior for all templates should be consistent.
We can either workaround this in our code or update the clang frontend to
pass the template rather than the specialization to HandleTopLevelDecl.
The latter seems cleaner, I'll try it out and see if anything breaks.
Could you describe the problem you are trying to solve? Maybe there are
alternative ways to go about it that don't involve looking at the template
PS in the meantime you could workaround in your code by visiting
VarTemplateSpecializationDecl, and calling
On Sun, Apr 21, 2019 at 11:40 PM Nathan Ridge via clangd-dev <
clangd-dev at lists.llvm.org> wrote:
> Hi folks,
> I've run into a strange issue when trying to use a RecursiveASTVisitor on
> an AST created by TestTU::build(): it seems that top-level variable
> template declarations are never visited, only their inner VarDecl is.
> I posted a patch with a test case illustrating the problem .
> The problem appears to be related to this call to
> ASTContext::setTraversalScope() . If I change that to set the traversal
> scope to the entire translation unit, the variable template declaration is
> visited correctly.
> I did some further digging and found that the proximate cause of the
> problem is this line in clang's parser code . However, I'm out of my
> depth here and don't know if this is actually a parser / AST bug, or a bug
> in how TestTU / ParsedAST are using these APIs.
> Any guidance would be appreciated!
>  https://reviews.llvm.org/D60954
> clangd-dev mailing list
> clangd-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the clangd-dev