frederic-tingaud-sonarsource wrote: Just having `TagDecl::isThisDeclarationADefinition()` return false in case of a forward declaration would in my opinion not solve the problem correctly, because that would make matching all class definitions in the AST extremely hard. Right now, it is just `m cxxRecordDecl(isDefinition())` which returns the template instantiations as expected, even if their source range cannot be queried. If we just change the result of `TagDecl::isThisDeclarationADefinition()`, they will no longer be found and these instantiations become extremely hard to find. Thinking about it a bit more, I'm not sure if the concept of "pattern" is something defined by the standard (I couldn't find it if it is), but when I access `Pattern`, I expect the pattern of my template to be the definition in all cases. I see [this comment](https://clang.llvm.org/doxygen/SemaTemplateInstantiate_8cpp_source.html#l04073) specifying "Get the instantiation pattern to use to instantiate the *definition* of a given `ClassTemplateSpecializationDecl`" which is in line with what I expect but not in line with what we get.
https://github.com/llvm/llvm-project/pull/156011 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits