[llvm] [CodeView] Match MSVC implicit this records for Visual Studio (PR #214289)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 02:29:45 PDT 2026


Nerixyz wrote:

> Of course, the last fix was specifically requested from Microsoft's relevant developers, who were informed to specifically parse "__this"

There is a difference between requiring a member to be named in a certain way compared to a local variable being encoded differently. In the first case, you either have a struct like `foo { bar *this; }`  or `foo { bar *__this; }`. But in the second case (this PR), both encodings (S_REGREL32 and S_LOCAL+DEFRANGE) encode the same variable.

> In other words, if it's a bug, why does the msvc/cl compiler work fine?

It's a bug because the debugger is generally able to show variables when they're encoded with S_LOCAL+DEFRANGE. In fact, you can see this if you rename `this` to `that` in the PDB. All of a sudden the debugger can show the variable.

Evidently it works fine if you encode it with S_REGREL32, but that doesn't have to be because of a bug on the LLVM side.

---

Now I'm not saying we must never do this workaround. But we should at least ask someone from Microsoft if `this` must be encoded differently or if it's a bug in the debugger before we implement this workaround.

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


More information about the llvm-commits mailing list