Pull request 936 in include-what-you-use: Use primary function template declaration for macro author intent

0 views
Skip to first unread message

notifi...@include-what-you-use.org

unread,
Jul 20, 2021, 8:40:26 AMJul 20
to include-wh...@googlegroups.com
New pull request 936 by kimgr: Use primary function template declaration for macro author intent
https://github.com/include-what-you-use/include-what-you-use/pull/936

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
issue 847.

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.

notifi...@include-what-you-use.org

unread,
Jul 20, 2021, 8:41:30 AMJul 20
to include-wh...@googlegroups.com
Comment #0 on pull request 936 by kimgr: Use primary function template declaration for macro author intent
https://github.com/include-what-you-use/include-what-you-use/pull/936

@stbergmann I think this fixes #847 -- could you try out the patch in the real world? Thanks.

notifi...@include-what-you-use.org

unread,
Jul 20, 2021, 8:55:41 AMJul 20
to include-wh...@googlegroups.com
Comment #1 on pull request 936 by stbergmann: Use primary function template declaration for macro author intent
https://github.com/include-what-you-use/include-what-you-use/pull/936

> @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.

notifi...@include-what-you-use.org

unread,
Jul 21, 2021, 3:32:04 AMJul 21
to include-wh...@googlegroups.com
Comment #3 on pull request 936 by vmiklos: Use primary function template declaration for macro author intent
https://github.com/include-what-you-use/include-what-you-use/pull/936

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!

Reply all
Reply to author
Forward
0 new messages