Reland "build: Pass -fcomplete-member-pointers when building with clang."
This is a reland of 4a2a5c4a with an additional check for use_xcode_clang. Original change's description: > build: Pass -fcomplete-member-pointers when building with clang. > > This prevents member pointers of incomplete base type from being used in > cases where they might cause problems under the Microsoft ABI. > > Specifically, the Microsoft ABI has different kinds of member pointers with > different sizes, and the choice of member pointer representation depends on > the inheritance hierarchy of the member pointer's base type. C++ allows a > member pointer's base type to be incomplete, so if it is incomplete at the > point where a variable of that member pointer type is declared, that forces > the compiler to pick the most general (i.e. largest) one. That can lead to > ODR violations since the most general representation wouldn't necessarily > be the one that would be chosen if the base type happened to be complete at > the point where the variable was declared. It can also be less size efficient > because the compiler will generally be able to choose a smaller representation > than the most general one if it were complete at the point where it is needed. > > This flag also enables additional semantic analysis that we'll need in order > to correctly implement -fsanitize=cfi for member function pointer calls. This > is because the inheritance hierarchy of the base type must be available in > order to make the CFI checks as precise as possible. > > Note that the flag is a -f flag rather than a -W flag. This is because > requiring member pointer base types to be complete is technically a > non-conforming language extension, as it may, for example, cause templates > to be instantiated which would otherwise not be, which may be observable > after code generation in conforming programs that were crafted to observe > it. However, the effects of this language extension should not be observable > in most ordinary programs. > > Bug: 847724 > Change-Id: I8d823fd4a6f21dfcadba55eefc0a69ef2e0c3479 > Reviewed-on: https://chromium-review.googlesource.com/1098217 > Commit-Queue: Peter Collingbourne <pcc@chromium.org> > Reviewed-by: Nico Weber <thakis@chromium.org> > Cr-Commit-Position: refs/heads/master@{#567086} Bug: 847724 Change-Id: I1b97980691914492945d170931d33438c68e8d0b Reviewed-on: https://chromium-review.googlesource.com/1101477Reviewed-by:Nico Weber <thakis@chromium.org> Reviewed-by:
Dirk Pranke <dpranke@chromium.org> Commit-Queue: Peter Collingbourne <pcc@chromium.org> Cr-Commit-Position: refs/heads/master@{#567505}
Showing
Please register or sign in to comment