This is an archive of the discontinued LLVM Phabricator instance.

16537 - Ensure the TR1 definition of POD is used for layout, regardless of LangOpts
ClosedPublic

Authored by jmagee on Jul 18 2013, 11:29 AM.

Details

Summary

Hello,

This is a fix for PR16537. As described in the bug, the TR1 definition of POD
should be used for the purposes of layout even when in C++11 mode. However,
when determining if a structure is PlainOldData (i.e., when calculating
data().PlainOldData in lib/AST/DeclCXX.cpp) the method isPODType() is called
and isPODType() will call either isCXX98PODType() or isCXX11PODType depending
on LangOpts. The effect of this is that when compiling in C++11 mode,
sometimes the TR1 definition of POD will be used and in other cases the C++11
definition of POD will be used.

The attached patch explicitly calls isCXX98PodType() which I believe is the
right thing to do. (Note, isCXX98PodType() calls isPOD(), which just queries
data().plainOldLayout, which means that PlainOldData should not be dependent on
the LangOpts otherwise isCXX98PodType() will not always return the correct
result when compiling in C++11 mode.)

This issue introduced a C++ ABI difference between 3.1 and 3.2 which affected
how tail padding was re-used when compiling in C++11 mode. The proposed patch
would fix the ABI, but this means there would be an ABI difference between 3.3
and 3.4. I think a change like this would warrant a mention in the release
notes. Should I include a patch that updates the release notes? What is the
procedure in this type of situation?

Thanks,
Josh

Diff Detail

Event Timeline

jmagee abandoned this revision.Jul 18 2013, 11:31 AM
This revision was automatically updated to reflect the committed changes.