baloghadamsoftware added a comment.

In D87527#2270939 <https://reviews.llvm.org/D87527#2270939>, @ymandel wrote:

> Can you expand on what is wrong currently for `FunctionDecl` descendants? 
> Would the new test `FindsBodyOfFunctionChildren` fail with the current 
> implementation?

Yes, exactly. They return 2 findings instead of 1 because the matcher matches 
both the forward declaration and the definition. The cause for this is that 
template specializations do not work for the descendants of the class for which 
is template specialized. Instead, the generic version is used. Thus for the 
children of `FunctionDecl` the original `GetBodyMatcher` is instantiated which 
does not check whether `doesThisDeclarationHaveABody()` but returns a body 
instead which may be bound to another declaration of the same function in the 
declaration chain. This is obviously wrong.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87527/new/

https://reviews.llvm.org/D87527

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to