[PATCH] D76801: [AST] Print a<b<c>> without extra spaces in C++11 or later.

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 17 14:05:13 PDT 2020


rnk added a subscriber: amccarth.
rnk added a comment.

In D76801#1989641 <https://reviews.llvm.org/D76801#1989641>, @sammccall wrote:

> I've got a sinking feeling that I misunderstood the implications of updating CodeGenCXX/debug-info-template-explicit-specialization.cpp and the Modules/*DebugInfo.cpp tests.
>  I assumed that these were human-readable names, not things that tools rely on. As you say maybe the dwarf changes broke things.
>  I don't really know much about debug info, @dblaikie do you think the DWARF changes in those tests are safe? If not, should I be documenting/mitigating this or trying to undo it?
>
> Regarding CodeView it sounds like we do need to undo this change. PrintingPolicy has:
>
>   /// Use whitespace and punctuation like MSVC does. In particular, this prints
>   /// anonymous namespaces as `anonymous namespace' and does not insert spaces
>   /// after template arguments.
>   unsigned MSVCFormatting : 1;
>   
>
> and this is set in `CGDebugInfo::getPrintingPolicy()` in CodeView mode.
>
> That seems like the right knob to change this behavior.
>  I'm not sure I know enough to write the codeview test, but I'll give it a shot and send that to you.


Yep, that sounds like the right fix. I was imagining some policy method `useMSVCFormatting` that flips both options together.

Hang on, I may have been too quick. We *do* have a test for this, at the end of clang/test/CodeGenCXX/debug-info-codeview-display-names.cpp:
https://github.com/llvm/llvm-project/blob/f8452ddfcc3336e42544a35481507f0b3bae423e/clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp#L98

The test passes for me locally, although I'm not sure why.

I would leave things a bit longer to give @amccarth more time to investigate and confirm. Thanks for the offer to help, though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76801





More information about the cfe-commits mailing list