Re: Pull request 1248 in include-what-you-use: Handle alias components separately

0 views
Skip to first unread message

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

unread,
May 17, 2023, 1:16:33 PM5/17/23
to include-wh...@googlegroups.com
Comment #1 on pull request 1248 by kimgr: Handle alias components separately
https://github.com/include-what-you-use/include-what-you-use/pull/1248

Could you expand a little on why `basic_fstream` and `basic_string` show up now? I wonder if we could address that in `ReportExplicitInstantiations` somehow.


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

unread,
May 21, 2023, 6:17:28 AM5/21/23
to include-wh...@googlegroups.com
Comment #2 on pull request 1248 by kimgr: Handle alias components separately
https://github.com/include-what-you-use/include-what-you-use/pull/1248

Thanks! Most of the test case changes look like strict improvements, questions about the others inline. Overall I also find the `WithouthSubstituted` naming a little confusing, hoping some concrete examples can help clarify there.


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

unread,
May 22, 2023, 2:11:51 PM5/22/23
to include-wh...@googlegroups.com
Comment #2 on pull request 1248 by kimgr: Handle alias components separately
https://github.com/include-what-you-use/include-what-you-use/pull/1248

Thanks! Most of the test case changes look like strict improvements, questions about the others inline. Overall I also find the `WithoutSubstituted` naming a little confusing, hoping some concrete examples can help clarify there.


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

unread,
May 23, 2023, 5:20:55 PM5/23/23
to include-wh...@googlegroups.com
Comment #3 on pull request 1248 by bolshakov-a: Handle alias components separately
https://github.com/include-what-you-use/include-what-you-use/pull/1248

> Could you expand a little on why basic_fstream and basic_string show up now? I wonder if we could address that in ReportExplicitInstantiations somehow.

Prior to my changes, underlying type analysis of these typedefs didn't even start because the type was considered as fully provided. I think the behavior on my branch is more correct, because for such piece of code:
```cpp
// Tpl.h
template <typename>
struct Tpl{};

typedef Tpl<char> Alias;

// explicit-instantiation-header.h
#include "Tpl.h"

extern template struct Tpl<char>;

// main.cpp
#include "Tpl.h"
#include "explicit-instantiation-header.h"

Alias t;
```
IWYU from the master branch suggests to remove `#include "explicit-instantiation-header.h"` from `main.cpp` and to keep on my branch.

Determining whether or not a typedef provides explicit instantiation may be difficult because, specifically, `stringfwd.h` (where `std::string` typedef is defined) from libstdcxx doesn't include `basic_string.tcc` where explicit instantiation is. Some sort of `PublicHeaderIntendsToProvide` logic might help, but it seems like overengineering. Or, maybe, is it important?


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

unread,
May 25, 2023, 3:45:42 PM5/25/23
to include-wh...@googlegroups.com
Comment #4 on pull request 1248 by kimgr: Handle alias components separately
https://github.com/include-what-you-use/include-what-you-use/pull/1248

> Or, maybe, is it important?

It seems like a pretty painful regression if uses of `std::fstream` result in mentions of `basic_fstream`. Ah, but it's only in diagnostics and `why`-comments? I guess it doesn't affect the suggested includes?


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

unread,
May 25, 2023, 3:59:45 PM5/25/23
to include-wh...@googlegroups.com
Comment #5 on pull request 1248 by bolshakov-a: Handle alias components separately
https://github.com/include-what-you-use/include-what-you-use/pull/1248

Yes, it should not affect suggested includes, because it seems like all of the stuff should be provided by `<string>` and `<fstream>` headers, correspondingly.


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

unread,
May 26, 2023, 2:56:45 PM5/26/23
to include-wh...@googlegroups.com
Comment #6 on pull request 1248 by kimgr: Handle alias components separately
https://github.com/include-what-you-use/include-what-you-use/pull/1248

@bolshakov-a Yeah, that sounds like a reasonable tradeoff, then. If the net result is better, I think we can live with some noise in reporting. I can try and think something up for the explicit instantiations later.


Reply all
Reply to author
Forward
0 new messages