Page MenuHomePhabricator

Implement Microsoft-compatible mangling for decomposition declarations.
ClosedPublic

Authored by epastor on Wed, Sep 4, 5:20 PM.

Details

Summary

Match cl.exe's mangling for decomposition declarations.

Decomposition declarations are considered to be anonymous structs, and use the same convention as for anonymous struct/union declarations.

Naming confirmed to match https://godbolt.org/z/K2osJa

Diff Detail

Repository
rL LLVM

Event Timeline

epastor created this revision.Wed, Sep 4, 5:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptWed, Sep 4, 5:20 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
epastor edited the summary of this revision. (Show Details)

Does this pass ninja check-clang? If so, can you add a test for the new mangling, based on the manglings in the godbolt example? See clang/test/CodeGenCXX/mangle-ms-* for many examples; a new file mangle-ms-cxx20.cpp might be appropriate here. You can run bin/llvm-lit -vv clang/test/CodeGenCXX/foo.cpp to run a single lit test for iterating on the local test.

ps: Thanks for the patch, this is great :)

pps: Since this uses struct mangling, llvm-undname can already demangle these names, right?

epastor updated this revision to Diff 218934.Thu, Sep 5, 8:52 AM
  • Add testing for the new deprecation declarations mangling

The change passes ninja check-clang - and I've added a test per your suggestions. Thanks!

As for llvm-undname: it works reasonably well, but these are anonymous names. It successfully recognizes $S1, etc. as the "name", though!

thakis accepted this revision.Thu, Sep 5, 12:16 PM

Thanks!

Re llvm-undname: That seems to match behavior of MSVC's undname, so I'd say that's all good :)

This revision is now accepted and ready to land.Thu, Sep 5, 12:16 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptThu, Sep 5, 2:08 PM