steakhal wrote: > > I'm somewhat surprised that it's necessary to visit template > > instantiations. This machine simply memorizes source locations. Template > > instantiations have the same source locations as the template itself right? > > (...right? 😳) > > LGTM because I'm sure there's a perfectly reasonable explanation for that. > > I see what you mean. I'll have a look tomorrow. Thanks for the reviews!
It actually didn't take long. Check the AST of the example: https://godbolt.org/z/MsT5jx3nE Funnily, the primary template is outside of the CXXRecordDecl. Only the template instantiation is under the CXXRecordDecl. That should explain the traversal. IDK why don't we have a primary template within the class. Maybe because there can only be exactly 1 primary template. And that is "spelled" outside of the class declaration, thus to remain truthful to the sources, then the primary template AST must also live where it's spelled. I think this is the explanation. Yeah, there are days when I hate C++, if you ask me. https://github.com/llvm/llvm-project/pull/168954 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
