From f0efbf6108126c4830694e0fff393e6cba300b03 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Tue, 5 Aug 2014 11:07:26 +0000 Subject: [PATCH] MachO: set sizeof result type to what embedded headers expect. Embedded systems seem to have inherited Darwin's choise of "unsigned long" for size_t (via a bunch of headers), so we should respect that. rdar://problem/17872787 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214854 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/Targets.cpp | 4 ++-- test/Sema/arm-darwin-aapcs.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 034bb07b05..eae369889c 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -3596,8 +3596,8 @@ class ARMTargetInfo : public TargetInfo { DoubleAlign = LongLongAlign = LongDoubleAlign = SuitableAlign = 64; const llvm::Triple &T = getTriple(); - // size_t is unsigned long on Darwin and NetBSD. - if (T.isOSDarwin() || T.getOS() == llvm::Triple::NetBSD) + // size_t is unsigned long on MachO-derived environments and NetBSD. + if (T.isOSBinFormatMachO() || T.getOS() == llvm::Triple::NetBSD) SizeType = UnsignedLong; else SizeType = UnsignedInt; diff --git a/test/Sema/arm-darwin-aapcs.cpp b/test/Sema/arm-darwin-aapcs.cpp index 1359a1dc15..3a6082ae40 100644 --- a/test/Sema/arm-darwin-aapcs.cpp +++ b/test/Sema/arm-darwin-aapcs.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -triple thumbv7-apple-ios -target-abi aapcs -verify -fsyntax-only +// RUN: %clang_cc1 %s -triple thumbv7m-apple-macho -target-abi aapcs -verify -fsyntax-only // expected-no-diagnostics // ARM's AAPCS normally has size_t defined as unsigned int, but on Darwin -- 2.40.0