Преглед на файлове

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332773 91177308-0d34-0410-b5e6-96231b3b80d8
Douglas Yung преди 7 години
родител
ревизия
ff7fef12a4
променени са 2 файла, в които са добавени 7 реда и са изтрити 4 реда
  1. 6 4
      lib/AST/RecordLayoutBuilder.cpp
  2. 1 0
      test/CodeGenCXX/alignment.cpp

+ 6 - 4
lib/AST/RecordLayoutBuilder.cpp

@@ -1178,10 +1178,12 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) {
   // Clang <= 6 incorrectly applied the 'packed' attribute to base classes.
   // Clang <= 6 incorrectly applied the 'packed' attribute to base classes.
   // Per GCC's documentation, it only applies to non-static data members.
   // Per GCC's documentation, it only applies to non-static data members.
   CharUnits UnpackedBaseAlign = Layout.getNonVirtualAlignment();
   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 we have an empty base class, try to place it at offset 0.
   if (Base->Class->isEmpty() &&
   if (Base->Class->isEmpty() &&

+ 1 - 0
test/CodeGenCXX/alignment.cpp

@@ -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 | 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-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 int int_source();
 extern void int_sink(int x);
 extern void int_sink(int x);