This is an archive of the discontinued LLVM Phabricator instance.

[clang] Module global init mangling
ClosedPublic

Authored by urnathan on Mar 30 2022, 8:58 AM.

Details

Reviewers
iains
bruno
Group Reviewers
Restricted Project
Commits
rGa1dcfb75ea8c: [clang] Module global init mangling
Summary

C++20 modules require emission of an initializer function, which is called by importers of the module. This implements the mangling for that function. It is the one place the ABI exposes partition names in symbols -- but fortunately only needed by other TUs of that same module.

Diff Detail

Event Timeline

urnathan created this revision.Mar 30 2022, 8:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2022, 8:58 AM
urnathan requested review of this revision.Mar 30 2022, 8:58 AM
bruno accepted this revision as: bruno.Mar 30 2022, 9:29 AM
bruno added a subscriber: bruno.
bruno added inline comments.
clang/lib/AST/ItaniumMangle.cpp
6545

Can you add a brief comment on what _ZGI means? LGTM with that change.

This revision is now accepted and ready to land.Mar 30 2022, 9:29 AM
bruno added a comment.Mar 30 2022, 9:33 AM

Forgot to ask, is there anything preventing a testcase to be added here?

Forgot to ask, is there anything preventing a testcase to be added here?

nothing is there to ask for the name (yet), @iains has it in his queue

iains added a comment.Apr 1 2022, 9:29 AM

(in initial testing) it seems that in the places we need to make the global initialisers, the mangling context is not Itanium-specific (although, presumably I could make the module initialiser conditional on that).

Do we know if there's a plan to implement the MS-specific mangling? (for now, I've hacked around this with a nonsensical implementation for MS in order to make progress on testing the initialiser code).

Do we know if there's a plan to implement the MS-specific mangling? (for now, I've hacked around this with a nonsensical implementation for MS in order to make progress on testing the initialiser code).

I'll ask Microsoft what that mangling is.

Do we know if there's a plan to implement the MS-specific mangling? (for now, I've hacked around this with a nonsensical implementation for MS in order to make progress on testing the initialiser code).

I'll ask Microsoft what that mangling is.

I have received no response

iains added a comment.Apr 25 2022, 7:13 AM

Do we know if there's a plan to implement the MS-specific mangling? (for now, I've hacked around this with a nonsensical implementation for MS in order to make progress on testing the initialiser code).

I'll ask Microsoft what that mangling is.

I have received no response

I have revised my code (which I suspect will be the first user of this) to use the patch here as-is, so this LGTM (and we can add mangling for Microsoft at a later time).

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2022, 9:03 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript