[llvm] Supports viewing class member variables in lambda when using the vs debugger (PR #71564)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 10:33:06 PST 2023


================
@@ -2605,6 +2605,9 @@ CodeViewDebug::lowerRecordFieldList(const DICompositeType *Ty) {
       MemberBaseType = TypeTable.writeLeafType(BFR);
     }
     uint64_t MemberOffsetInBytes = MemberOffsetInBits / 8;
+    if (Ty->getName().find("<lambda") != std::string::npos) {
+      MemberName = "__this";
+    }
----------------
dwblaikie wrote:

This should probably be done by checking whether the `Ty` is a lambda, rather than searching through its name. Oh, this is down in LLVM, so we wouldn't have any info about this.

So maybe this should be up in clang? Hmm, even compiling for a windows target, I don't see a member for the `this` pointer in the LLVM IR metadata - we only get members for the captures, by the looks of it... 

Maybe this MemberInfo stuff is PDB specific/maybe it synthesizes a this pointer from somewhere else... 

I'll leave this to folks more familiar with the PDB side of things.

https://github.com/llvm/llvm-project/pull/71564


More information about the llvm-commits mailing list