r207929 - Target: fix wchar_t definition for Windows on ARM
Saleem Abdulrasool
compnerd at compnerd.org
Sat May 3 18:56:04 PDT 2014
Author: compnerd
Date: Sat May 3 20:56:04 2014
New Revision: 207929
URL: http://llvm.org/viewvc/llvm-project?rev=207929&view=rev
Log:
Target: fix wchar_t definition for Windows on ARM
Windows on ARM uses AAPCS, but has some deviations. wchar_t remains an unsigned
short on WoA, which does not conform to AAPCS. Ensure that wchar_t is defined
accordingly.
Added:
cfe/trunk/test/Preprocessor/woa-wchar_t.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=207929&r1=207928&r2=207929&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat May 3 20:56:04 2014
@@ -3784,11 +3784,18 @@ class ARMTargetInfo : public TargetInfo
else
SizeType = UnsignedInt;
- if (T.getOS() == llvm::Triple::NetBSD) {
+ switch (T.getOS()) {
+ case llvm::Triple::NetBSD:
WCharType = SignedInt;
- } else {
+ break;
+ case llvm::Triple::Win32:
+ WCharType = UnsignedShort;
+ break;
+ case llvm::Triple::Linux:
+ default:
// AAPCS 7.1.1, ARM-Linux ABI 2.4: type of wchar_t is unsigned int.
WCharType = UnsignedInt;
+ break;
}
UseBitFieldTypeAlignment = true;
Added: cfe/trunk/test/Preprocessor/woa-wchar_t.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/woa-wchar_t.c?rev=207929&view=auto
==============================================================================
--- cfe/trunk/test/Preprocessor/woa-wchar_t.c (added)
+++ cfe/trunk/test/Preprocessor/woa-wchar_t.c Sat May 3 20:56:04 2014
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -dM -triple armv7-windows -E %s | FileCheck %s
+// RUN: %clang_cc1 -dM -fno-signed-char -triple armv7-windows -E %s | FileCheck %s
+
+// CHECK: #define __WCHAR_TYPE__ unsigned short
+
More information about the cfe-commits
mailing list