This is an archive of the discontinued LLVM Phabricator instance.

Debug Info: Support DW_AT_calling_convention on composite types
ClosedPublic

Authored by aprantl on Jan 4 2018, 1:21 PM.

Details

Summary

This implements the DWARF 5 feature described at
http://www.dwarfstd.org/ShowIssue.php?issue=141215.1

This allows a consumer to understand whether a composite data type is
trivially copyable and thus should be passed by value instead of by
reference. The canonical example is being able to distinguish the
following two types:

// S is not trivially copyable because of the explicit destructor.
struct S {
   ~S() {}
};

// T is a POD type.
struct T {
   ~T() = default;
};

This patch adds two new (DI)flags to LLVM metadata: TypePassByValue
and TypePassByReference.

Diff Detail

Event Timeline

aprantl created this revision.Jan 4 2018, 1:21 PM
dblaikie accepted this revision.Jan 4 2018, 1:26 PM

Fine by me - this'll also be necessary/useful for the upcoming trivial_abi attribute that's being proposed in clang, I think.

I guess there's no worry that we'll want to add another state here (currently: None, Reference, Value) & then want to use the two bits differently to pack all 4 states into 2 bits.

This revision is now accepted and ready to land.Jan 4 2018, 1:26 PM

Fine by me - this'll also be necessary/useful for the upcoming trivial_abi attribute that's being proposed in clang, I think.

Exactly :-)

I guess there's no worry that we'll want to add another state here (currently: None, Reference, Value) & then want to use the two bits differently to pack all 4 states into 2 bits.

At this point I don't forsee that coming up. And we could still use the 1 1 state for a third value if need be.

aprantl closed this revision.Jan 4 2018, 5:23 PM

Landed in r321844.