mizvekov wrote:

> We're seeing a tiny change in the AST in our highly customized traversal in 
> IWYU -- I thought I'd highlight it here, because I have a feeling it could 
> cause subtle ripple effects elsewhere.
> 
> It looks like traversing the AST of a template instantiation would previously 
> see the definition of instantiated function decls, but after this patch, we 
> see a non-def declaration (possibly the latest in the redecl chain).

Yes, one of the consequences of the patch. What clang used to do, when 
instantiating templated functions, it would keep only one instantiated 
declaration. Later when instantiating its definition, it would just slap 
whatever definition it would find, which could belong to a different template 
context.

Because in C++ with friend function declaration that's possible, you can 
provide a definition in a fiend declaration, that can be in a class template. 
So some declarations are templated, others not, and the AST couldn't quite 
capture that distinction.

But in terms of what users of the API have to do, is just not to assume there 
is only the definition, same as you can't already assume that for non-templated 
functions. So you are just missing a 'getDefinition' or 'getDefinitonOrSelf' 
call somewhere.

https://github.com/llvm/llvm-project/pull/208601
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to