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
This commit is contained in:
Douglas Yung 2018-05-18 21:51:46 +00:00
parent 746b78de78
commit ff7fef12a4
2 changed files with 7 additions and 4 deletions

View File

@ -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() <= CharUnits BaseAlign =
LangOptions::ClangABI::Ver6) (Packed && ((Context.getLangOpts().getClangABICompat() <=
? CharUnits::One() LangOptions::ClangABI::Ver6) ||
: UnpackedBaseAlign; 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() &&

View 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 | 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);