This is an archive of the discontinued LLVM Phabricator instance.

Implement Microsoft-compatible mangling for decomposition declarations.
ClosedPublic

Authored by epastor on Sep 4 2019, 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.Sep 4 2019, 5:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 4 2019, 5:20 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
epastor edited the summary of this revision. (Show Details)
thakis added a comment.Sep 4 2019, 5:38 PM

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.

thakis added a comment.Sep 4 2019, 5:39 PM

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.Sep 5 2019, 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.Sep 5 2019, 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.Sep 5 2019, 12:16 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 5 2019, 2:08 PM