Fix the LowerGlobalDtors pass to run destructors in the same order as the regular LLVM destructor lowering -- in reverse order, and not ordered to group destructors with common associated objects.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
the commit description says "not ordered to group destructors with common associated objects" but it looks this patch is doing grouping by associated object. Is that intentional?
Also, maybe there should be a test which has destructors of different priorities associated with the same object?
(also, the langref says that the order within a priority is unspecfied. is something depending on this ordering (I assume so, since you bothered to change it)?
- Add a comment.
- Add a test of two destructors with different priorities and the same associated object.
The commit description says "not ordered to group destructors with common associated objects" but it looks this patch is doing grouping by associated object. Is that intentional?
It groups adjacent destructors which happen to have the same associated
object, but doesn't order them by the associated object. I've now added a
comment to clarify that.
Also, maybe there should be a test which has destructors of different priorities associated with the same object?
Test added.
(also, the langref says that the order within a priority is unspecfied. is something depending on this ordering (I assume so, since you bothered to change it)?
C++ says we need to run the destructors in reverse order from the
corresponding constructors, so we need to match the order.