]> granicus.if.org Git - clang/commitdiff
Maintain PS4 ABI compatibility by making the fix made in r331136 not apply when the...
authorDouglas Yung <douglas.yung@sony.com>
Fri, 18 May 2018 21:51:46 +0000 (21:51 +0000)
committerDouglas Yung <douglas.yung@sony.com>
Fri, 18 May 2018 21:51:46 +0000 (21:51 +0000)
Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D47084

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332773 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/RecordLayoutBuilder.cpp
test/CodeGenCXX/alignment.cpp

index 64c1a02cef18c50db322941f6028b48805a039ef..988b88b39b4a8a15f672c8a8b90fd67be6d2a544 100644 (file)
@@ -1178,10 +1178,12 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) {
   // 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() &&
index 2549afda8828003399a89b3035d6cb3c4b7e2a47..37509fcb4dd55cde72cdf9bf668ee6f321f33d20 100644 (file)
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin10 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOCOMPAT
 // RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin10 -fclang-abi-compat=6.0 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V6COMPAT
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-scei-ps4 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V6COMPAT
 
 extern int int_source();
 extern void int_sink(int x);