With the demangler parenthesizing 'a >> b' inside template parameters, because C++11 parsing of >> there, we don't really need to add spaces between adjacent template arg closing '>' chars. In 2022, that just looks odd.
bruno dblaikie jhenderson MaskRay
- Group Reviewers
- rGbc150a07f1a1: [demangler] No need to space adjacent template closings
Doesn't look like all the cases are tested? (eg: I searched for basic_iostream and I only see the source change but no test change) - I realize some of these may be previously missing test coverage, but would you mind checking/adding the missing coverage?
& I think maybe @rjmccall had signed off on this direction in another review - could you link to his comment in the patch description? (or if I'm misremembering, maybe someone else had OK'd the direction?)
I think you're right that I signed off on it; I don't remember when or where that was, or what I said about it then, but regardless I can tell you that there are two basic reasons:
- First, the result of demangling to a string is not source code. It produces valid source code as much as it can, and that's a good choice, but there are common cases where it cannot just produce source, and there is no use case that requires it to produce source. Ultimately, this is just a string that is going to be presented to a human.
- Since we're just going to present it to a human, what mainly matters is what the human's expectations are. Approximately no C++ programmers will be confused to see >> terminating a template argument list, in part because it's been a long since since C++11 was available, but also simply because it was unnatural for programmers to remember to include the space in the first place, to the point that any reasonable compiler had to catch it and recover as a common error.
If you want to put that in the commit, feel free.
This makes sense. In addition, clang's type printer has omitted space in >> since 2021 (a change by sammccall).