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

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 22 11:13:07 PST 2021


rnk added a comment.

I see a variety of presubmit failures in Harbormaster that seem related, so make sure to check those.



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


================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:320-321
 
   // The CodeView printer in LLVM wants to see the names of unnamed types: it is
   // used to reconstruct the fully qualified type names.
   if (CGM.getCodeGenOpts().EmitCodeView) {
----------------
I think this comment could be improved, and I think it would help address some of David's concerns in the previous patch about the format requirements of codeview.


================
Comment at: clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp:13
 
+auto lambda1 = []() { return 1; };
+
----------------
Please add tests for a lambda in an inline function and one in a non-inline function. The inline lambda will be externally visible and have a mangling number, and the non-inline one will be internal, and will not have a mangling number. They should both get `<lambda_n>` names, though.


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