diff options
-rw-r--r-- | clang/lib/Basic/Targets.cpp | 3 | ||||
-rw-r--r-- | clang/test/Sema/arm-darwin-aapcs.cpp | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 4e2d223c6bf..744a437fde5 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -3642,6 +3642,9 @@ public: // FIXME: Override "preferred align" for double and long long. } else if (Name == "aapcs" || Name == "aapcs-vfp") { + // size_t is unsigned long on Darwin. + if (getTriple().isOSDarwin()) + SizeType = UnsignedLong; IsAAPCS = true; // FIXME: Enumerated types are variable width in straight AAPCS. } else if (Name == "aapcs-linux") { diff --git a/clang/test/Sema/arm-darwin-aapcs.cpp b/clang/test/Sema/arm-darwin-aapcs.cpp new file mode 100644 index 00000000000..1359a1dc15a --- /dev/null +++ b/clang/test/Sema/arm-darwin-aapcs.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -triple thumbv7-apple-ios -target-abi aapcs -verify -fsyntax-only +// expected-no-diagnostics + +// ARM's AAPCS normally has size_t defined as unsigned int, but on Darwin +// some embedded targets use AAPCS with the iOS header files, which define +// size_t as unsigned long. Make sure that works. +typedef unsigned long size_t; +void* malloc(size_t); +void* operator new(size_t size) +{ + return (malloc(size)); +} |