[PATCH] D95187: [DebugInfo][CodeView] Use <lambda_n> as the display name for lambdas.

Amy Huang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 26 12:22:48 PST 2021


akhuang added inline comments.


================
Comment at: clang/include/clang/AST/Mangle.h:92
 
+  virtual StringRef getLambdaString(const CXXRecordDecl *Lambda) = 0;
+
----------------
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? 


================
Comment at: clang/lib/AST/ItaniumMangle.cpp:210
+    if (Number == 0)
+      return getAnonymousStructId(Lambda);
+    return Number;
----------------
rnk wrote:
> This has the potential to create a situation where enabling debug info changes the internal mangled names that clang uses. To be *extra* safe, you could add a method like `getAnonymousStructIdForDebugInfo` that does .find instead of .insert, and use it here.
Oh, right, yeah. I guess I'll just let it return 0 if it's not found.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95187



More information about the cfe-commits mailing list