This is an archive of the discontinued LLVM Phabricator instance.

MS ABI: Insert copy-constructors into the CatchableType
ClosedPublic

Authored by majnemer on Mar 6 2015, 12:21 AM.

Details

Summary

Find all unambiguous public classes of the exception object's class type
and reference all of their copy constructors. Yes, this is not
conforming but it is necessary in order to implement their ABI. This is
because the copy constructor is actually referenced by the metadata
describing which catch handlers are eligible to handle the exception
object.

N.B. This doesn't yet handle the copy constructor closure case yet,
that work is ongoing.

Diff Detail

Repository
rL LLVM

Event Timeline

majnemer updated this revision to Diff 21335.Mar 6 2015, 12:21 AM
majnemer retitled this revision from to MS ABI: Insert copy-constructors into the CatchableType.
majnemer updated this object.
majnemer added a reviewer: rnk.
majnemer added a subscriber: Unknown Object (MLST).
rnk added inline comments.Mar 6 2015, 10:45 AM
lib/AST/MicrosoftMangle.cpp
2313 ↗(On Diff #21335)

Does this get mangled to __CT... on 32-bit? Do we need \01?

2315–2320 ↗(On Diff #21335)

Stupid '\01' mangling. When we drop it, we can simply run the mangler on the Out stream.

2325 ↗(On Diff #21335)

I guess the Microsoft mangler ignores the ctor type because there's only one. =D

lib/Sema/SemaExprCXX.cpp
661 ↗(On Diff #21335)

Wee, more DFS.

790–791 ↗(On Diff #21335)

Huh, so previously I thought a null copy ctor entry meant the copy ctor was deleted, but I guess it actually means it's trivial. If you ever try to catch a type with a deleted copy ctor by value, we diagnose, so the runtime will never accidentally memcpy an uncopyable type.

rnk accepted this revision.Mar 6 2015, 10:45 AM
rnk edited edge metadata.

lgtm

This revision is now accepted and ready to land.Mar 6 2015, 10:45 AM
majnemer added inline comments.Mar 6 2015, 10:47 AM
lib/AST/MicrosoftMangle.cpp
2313 ↗(On Diff #21335)

Yes, it gets mangled to __CT on 32-bit which would mean that we wouldn't want \01, right?

2315–2320 ↗(On Diff #21335)

Happily :)

This revision was automatically updated to reflect the committed changes.