ahatanak created this revision. ahatanak added reviewers: rjmccall, arphaman, ab. ahatanak added a project: clang. Herald added subscribers: ributzka, jkorous. ahatanak requested review of this revision.
The guaranteed alignment is 16-bytes on 64-bit Darwin. rdar://73431623 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D95910 Files: clang/lib/Basic/TargetInfo.cpp clang/test/Preprocessor/init-aarch64.c Index: clang/test/Preprocessor/init-aarch64.c =================================================================== --- clang/test/Preprocessor/init-aarch64.c +++ clang/test/Preprocessor/init-aarch64.c @@ -532,6 +532,9 @@ // AARCH64-DARWIN: #define __WINT_WIDTH__ 32 // AARCH64-DARWIN: #define __aarch64__ 1 +// RUN: %clang_cc1 -E -dM -triple=aarch64-apple-ios7.0 -x c++ < /dev/null | FileCheck -match-full-lines -check-prefix AARCH64-DARWIN-CXX %s +// AARCH64-DARWIN-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL + // RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-windows-msvc < /dev/null | FileCheck -match-full-lines -check-prefix AARCH64-MSVC %s // AARCH64-MSVC: #define _INTEGRAL_MAX_BITS 64 Index: clang/lib/Basic/TargetInfo.cpp =================================================================== --- clang/lib/Basic/TargetInfo.cpp +++ clang/lib/Basic/TargetInfo.cpp @@ -67,8 +67,9 @@ // From the glibc documentation, on GNU systems, malloc guarantees 16-byte // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html. - // This alignment guarantee also applies to Windows and Android. - if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid()) + // This alignment guarantee also applies to Windows, Android, and Darwin. + if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid() || + T.isOSDarwin()) NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0; else NewAlign = 0; // Infer from basic type alignment.
Index: clang/test/Preprocessor/init-aarch64.c =================================================================== --- clang/test/Preprocessor/init-aarch64.c +++ clang/test/Preprocessor/init-aarch64.c @@ -532,6 +532,9 @@ // AARCH64-DARWIN: #define __WINT_WIDTH__ 32 // AARCH64-DARWIN: #define __aarch64__ 1 +// RUN: %clang_cc1 -E -dM -triple=aarch64-apple-ios7.0 -x c++ < /dev/null | FileCheck -match-full-lines -check-prefix AARCH64-DARWIN-CXX %s +// AARCH64-DARWIN-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL + // RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-windows-msvc < /dev/null | FileCheck -match-full-lines -check-prefix AARCH64-MSVC %s // AARCH64-MSVC: #define _INTEGRAL_MAX_BITS 64 Index: clang/lib/Basic/TargetInfo.cpp =================================================================== --- clang/lib/Basic/TargetInfo.cpp +++ clang/lib/Basic/TargetInfo.cpp @@ -67,8 +67,9 @@ // From the glibc documentation, on GNU systems, malloc guarantees 16-byte // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html. - // This alignment guarantee also applies to Windows and Android. - if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid()) + // This alignment guarantee also applies to Windows, Android, and Darwin. + if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid() || + T.isOSDarwin()) NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0; else NewAlign = 0; // Infer from basic type alignment.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits