akhuang added inline comments.
================
Comment at: clang/include/clang/AST/Mangle.h:92
+ virtual StringRef getLambdaString(const CXXRecordDecl *Lambda) = 0;
+
----------------
rnk wrote:
> akhuang wrote:
> > rnk wrote:
> > > I think I would prefer to have this return a number. I think CGDebugInfo
> > > should be responsible for the formatting of the display names, not the
> > > mangler. Both the MS and Itanium manglers have private methods for
> > > numbering internal linkage lambdas, and I think it would be reasonable to
> > > hook those up to a public virtual method.
> > I used a string because we mangle some lambdas like <lambda_1_1> (when
> > they're used as function parameters).
> > Maybe we don't need to differentiate between these lambdas though?
> I see. So, the situation we are worried about would look like:
>
> ```
> struct Foo {
> static volatile int arg1_defaults, arg2_defaults;
> static void foo(
> int arg1 = []() { return ++arg1_defaults; }(),
> int arg2 = []() { return ++arg2_defaults; }());
> };
> void bar() { Foo::foo(); }
> ```
>
> In this case, if we use numbers here, we'd end up using the names
> `Foo::<lambda_1>` `Foo::<lambda_1>`, and those would end up being duplicate
> LF_FUNC_IDs. Darn.
>
> You were right, we better go back to using strings. Sorry about that. That
> makes a good test, though. :)
Yep. I don't know what it should output for the Itanium version though. I guess
it could just do the same thing, even though we don't use that string anywhere
there.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95187/new/
https://reviews.llvm.org/D95187
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits