Currently we iterate two DenseMaps when marking virtual members used. The problem is that the output order depends on the order they are marked. There are some options on how to fix this
1 Define a comparison function for all functions and sort DeferredDeclsToEmit before iterating over it. 2 Define a comparison function for at least all the virtual functions that go in a vtable and sort that in MarkVirtualMembersReferenced. 3 Use existing deterministic iterators in MarkVirtualMembersReferenced. 4 Add a deterministic iterator to CXXFinalOverriderMap. fpichet on irc suggested using source code order for the comparisons, but I am not sure that would work in cases like class foo : public bar<int>, public bar<float>... since the methods from bar<T> would show up twice. I have implemented 3 by manually iterating over the methods and bases of a class. I am not all that happy with the result. The method getFinalOverriders already does a similar walk. The situation is even worse when we need a VTT, as we call getFinalOverriders multiple times (but that is already the case without this patch). For option 4 we would need to replace the DenseMap in CXXFinalOverriderMap with some ordered set container that remembers the order in which getFinalOverriders found the members. Cheers, Rafael
t.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
