We already have a rule that if a decl is used entirely inside a macro, and it's
forward-declared in the macro file, the use is attributed to the expansion
location. This, however, did not cover template specializations, as described in
So now we treat a primary function template declaration in the macro file as a
regular forward-declaration, which means that function template specializations
used in macros will be attributed to the expansion location iff the primary
template has a declaration in the macro file.
@stbergmann I think this fixes #847 -- could you try out the patch in the real world? Thanks.
> @stbergmann I think this fixes #847 -- could you try out the patch in the real world? Thanks.
I don't use iwyu myself, and only filed #847 following the discussion in the comments at LibreOffice commit <https://gerrit.libreoffice.org/c/core/+/105315/2#message-f5292b496cf1f5c78d6381bc3e2a59320e8ffbb9> "tdf#42949 Fix new IWYU warnings in directories c*", but @vmiklos might be interested.
Yes, I just tried this PR on libreoffice/core.git, the original cppu/qa/test_any.cxx had this problem that o3tl/cppunittraitshelper.hxx was suggested for removal and this is now gone. As I understand it, that was the source of the stripped down sample in the issue. Thanks!