r214854 - MachO: set sizeof result type to what embedded headers expect.

Tim Northover tnorthover at apple.com
Tue Aug 5 04:07:27 PDT 2014


Author: tnorthover
Date: Tue Aug  5 06:07:26 2014
New Revision: 214854

URL: http://llvm.org/viewvc/llvm-project?rev=214854&view=rev
Log:
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

Modified:
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/test/Sema/arm-darwin-aapcs.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=214854&r1=214853&r2=214854&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Aug  5 06:07:26 2014
@@ -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;

Modified: cfe/trunk/test/Sema/arm-darwin-aapcs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/arm-darwin-aapcs.cpp?rev=214854&r1=214853&r2=214854&view=diff
==============================================================================
--- cfe/trunk/test/Sema/arm-darwin-aapcs.cpp (original)
+++ cfe/trunk/test/Sema/arm-darwin-aapcs.cpp Tue Aug  5 06:07:26 2014
@@ -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





More information about the cfe-commits mailing list