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

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 13 23:14:14 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";
+    }
----------------
GkvJwa wrote:

Good, I tried patching it here and it also works, and the pdb compiled by msvc also has operators:
```
 0x465D | LF_FIELDLIST [size = 160, hash = 0x26758]
          - LF_ONEMETHOD [name = `operator()`]
            type = 0x4653, vftable offset = -1, attrs = public
          - LF_METHOD [name = `<lambda_1>`, # overloads = 2, overload list = 0x4658]
          - LF_MEMBER [name = `__this`, Type = 0x464E, offset = 0, attrs = private]
          - LF_MEMBER [name = `aa`, Type = 0x0074 (int), offset = 8, attrs = private]
          - LF_MEMBER [name = `bb`, Type = 0x0074 (int), offset = 12, attrs = private]
          - LF_MEMBER [name = `cc`, Type = 0x0074 (int), offset = 16, attrs = private]
          - LF_ONEMETHOD [name = `operator=`]
            type = 0x465C, vftable offset = -1, attrs = public
          - LF_ONEMETHOD [name = `__autoclassinit2`]
```
Not sure what it means

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


More information about the cfe-commits mailing list