[clang] [clang] Correct Microsoft mangling of lifetime extended temporary objects. (PR #85529)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 18 05:06:40 PDT 2024
================
@@ -54,6 +54,12 @@ ABI Changes in This Version
inline member function that contains a static local variable with a dynamic
initializer is declared with ``__declspec(dllimport)``. (#GH83616).
+- Fixed Microsoft name mangling of lifetime extended temporary objects. This
+ change corrects missing back reference registrations that could result in
+ incorrect back reference indexes and suprising demangled name results. Since
+ MSVC uses a different mangling for these objects, compatibility is not affected.
+ (#GH85423).
----------------
zmodem wrote:
> Commit [e77de75](https://github.com/llvm/llvm-project/commit/e77de75d7e009daaadb03e9b1091c3a9a9c9d311) claims that Microsoft doesn't have a mangling for these objects and that the `$RT` mangling is a Clang invention. The claim that MSVC doesn't implement a mangling for these doesn't seem right though. Consider https://godbolt.org/z/n715zPbc6.
Looks like things have changed then. I tried the example code with MSVC 18.00.31101.0 (from VS2013) and there the object is just `_$S1`:
```
??__E?singleton at RT1@@2ABU1 at B@@YAXXZ PROC ; ??__E?singleton at RT1@@2ABU1 at B@@YAXXZ, COMDAT
; File z:\tmp\a.cc
; Line 6
push ebp
mov ebp, esp
push ecx
call ?f@@YA?AURT1@@XZ ; f
mov DWORD PTR $T1[ebp], eax
mov eax, DWORD PTR $T1[ebp]
mov DWORD PTR _$S1, eax
mov DWORD PTR ?singleton at RT1@@2ABU1 at B, OFFSET _$S1 ; RT1::singleton
mov esp, ebp
pop ebp
ret 0
```
https://github.com/llvm/llvm-project/pull/85529
More information about the cfe-commits
mailing list