Maintain PS4 ABI compatibility by making the fix made in r331136 not apply when the target is the PS4.
Reviewers: rsmith
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D47084
llvm-svn: 332773
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp
index 64c1a02..988b88b 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -1178,10 +1178,12 @@
// Clang <= 6 incorrectly applied the 'packed' attribute to base classes.
// Per GCC's documentation, it only applies to non-static data members.
CharUnits UnpackedBaseAlign = Layout.getNonVirtualAlignment();
- CharUnits BaseAlign = (Packed && Context.getLangOpts().getClangABICompat() <=
- LangOptions::ClangABI::Ver6)
- ? CharUnits::One()
- : UnpackedBaseAlign;
+ CharUnits BaseAlign =
+ (Packed && ((Context.getLangOpts().getClangABICompat() <=
+ LangOptions::ClangABI::Ver6) ||
+ Context.getTargetInfo().getTriple().isPS4()))
+ ? CharUnits::One()
+ : UnpackedBaseAlign;
// If we have an empty base class, try to place it at offset 0.
if (Base->Class->isEmpty() &&