[PATCH] D146386: [MS ABI] Fix mangling references to declarations.

Andrey Ali Khan Bolshakov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 19 11:03:32 PDT 2023


bolshakov-a created this revision.
bolshakov-a added reviewers: erichkeane, rnk.
Herald added a project: All.
bolshakov-a requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Several issues have been discovered and (hopefully) fixed here:

- Reference NTTPs should be mangled in the same manner as pointer ones.

- Pointer fields of class type NTTPs should be treated in the same

manner as reference ones.

- Pointer-to-member fields of class type NTTPs should be treated

differently compared to pointer-to-member NTTPs. Tests on
pointer-to-member-function NTTP class fields added.

Reference NTTP mangling was done back in 2013
in e8fdc06e0dab2e7b98339425dbe369e27e2092a3, and Microsoft might change
mangling algorithm since then. But class type NTTPs are introduced only
in C++20, and the test was written in b637148ecb62b900872b34eedd78b923bb43c378 <https://reviews.llvm.org/rGb637148ecb62b900872b34eedd78b923bb43c378>.
It is strange if the MS ABI had been realy changed, because Microsoft
claims that they maintain ABI stability since VS 2015. I've tested both
on v142 and v143 MSVC toolsets, and they show the same behavior
on the test cases which are changed in this PR. But
pointer-to-member-function NTTP class field mangling has been actually
changed, because it was erroneous in v142, leading to name collisions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146386

Files:
  clang/lib/AST/MicrosoftMangle.cpp
  clang/test/CodeGenCXX/mangle-class-nttp.cpp
  clang/test/CodeGenCXX/mangle-ms-templates.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146386.506408.patch
Type: text/x-patch
Size: 9653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230319/51594366/attachment.bin>


More information about the cfe-commits mailing list