Page MenuHomePhabricator

[MS ABI] Mangle unnamed empty enums (PR37723)

Authored by hans on Jun 7 2018, 4:53 AM.

Diff Detail


Event Timeline

hans created this revision.Jun 7 2018, 4:53 AM

Please take a look.

I couldn't figure out a way to get a mangled name for this without using debug info. Do you have any ideas?

majnemer added inline comments.Jun 7 2018, 7:54 AM
888–891 ↗(On Diff #150299)

Thinking about it some more, it'd be better if we handled this like the else case:

Name += "<unnamed-type-$S";
Name += llvm::utostr(Context.getAnonymousStructId(TD) + 1);

Reason being that something like:

struct S {
  enum {};
  enum {};

Would otherwise end up with two identical mangles.

This would also make us more consistent with other mangles, for example:

enum {} x;
struct {} y;

These are mangled as: <unnamed-type-x> and <unnamed-type-y>.

hans added a comment.Jun 7 2018, 8:01 AM


888–891 ↗(On Diff #150299)

Okay, yeah that makes sense.

I just checked

struct S {

enum {};
enum {};


with MSVC, and they seem to give them identical mangling.

I have to head out, but will update the patch tomorrow morning unless you're keen to do it :-)

hans updated this revision to Diff 150462.Jun 8 2018, 1:26 AM

Falling back to the "Otherwise, number using $S" code for non-empty enums.

majnemer accepted this revision.Jun 8 2018, 4:35 PM


This revision is now accepted and ready to land.Jun 8 2018, 4:35 PM
This revision was automatically updated to reflect the committed changes.