Michael137 wrote:

> > @dwblaikie @rnk It's been a minute but here's the "canonical lambda names 
> > in debug-info" that we talked about in #159592
> > The interesting bit is the 3rd commit.
> > Before:
> > ```
> >   // CHECK: !DISubprogram(name: "f1<(lambda at 
> > {{.*}}simple-template-names.cpp:[[# @LINE - 2]]:17)>",
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > After:
> > ```
> >   // CHECK: !DISubprogram(name: "f1<f()::(lambda1)>",
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > Still in draft mode until I verify that this does the right thing for 
> > namespace contexts too. Also getting some debug-info size numbers
> 
> That looks plausible - this WIP is only for lambdas, not for anonymous 
> structs/classes/enums, etc? Might be worth looking at those too to see if the 
> design is amenable to addressing those too.

This patch should also work for non-lambda anonymous entities. I'll need to add 
some tests for those

> Also, addressing the canonicalization problem is only part of the solution 
> for being able to use this for Simplified Template Names - the other part 
> would be needing to encode this data (like the mangling number) in the DWARF. 
> I guess we could put this stable name (the unqualified version of it, at 
> least) in the DW_AT_name of the lambda, it's /probably/ better than no name 
> at all (though no name is more accurate).

Right good point. For now I wasn't focused on solving the simple-template-name 
reconstitution issue for now. But definitely good to follow-up on this after 
this lands. I'd have to think more about that but off the top your suggestion 
re. DW_AT_name sounds reasonable (though will need to be careful with 
debug-info size there).

> Did you check two lambdas with different signatures? 
> https://godbolt.org/z/qsvbfTs1f - the lambdas in inline function `f1` get a 
> mangling number unique to the signature (so two lambdas with different 
> signatures both get the mangling number 1) whereas in f3 (an extern linkage 
> function) get numbered 1 and 2 (just a different choice in mangling - since 
> the lambdas in f3 don't have external linkage, they can have any name we 
> choose and we choose non-signature-scoped-numbering (GCC uses the inline type 
> example))

Yea i still need to elaborate on the test cases. The previous version of this 
patch wasn't using the lambda mangling number (which is different from 
non-lambda mangling number). Latest version of the patch aligns with GCC, 
though will add more tests before marking for review. Thanks for taking a 
preliminary look!

https://github.com/llvm/llvm-project/pull/168533
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to