aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Frontend/InitPreprocessor.cpp2
-rw-r--r--test/Preprocessor/init.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
index e5a4169502..88feca953a 100644
--- a/lib/Frontend/InitPreprocessor.cpp
+++ b/lib/Frontend/InitPreprocessor.cpp
@@ -173,7 +173,7 @@ static void DefineTypeSize(llvm::StringRef MacroName, unsigned TypeWidth,
assert(TypeWidth != 1);
MaxVal = ~0ULL >> (65-TypeWidth);
} else
- MaxVal = ~0LL >> (64-TypeWidth);
+ MaxVal = ~0ULL >> (64-TypeWidth);
Builder.defineMacro(MacroName, llvm::Twine(MaxVal) + ValSuffix);
}
diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c
index 8283671b66..4ebaddfa3f 100644
--- a/test/Preprocessor/init.c
+++ b/test/Preprocessor/init.c
@@ -117,6 +117,13 @@
// SCHAR-NOT:#define __UNSIGNED_CHAR__
// SCHAR:#define __clang__ 1
//
+// RUN: %clang_cc1 -E -dM -fshort-wchar < /dev/null | FileCheck -check-prefix SHORTWCHAR %s
+//
+// SHORTWCHAR: #define __SIZEOF_WCHAR_T__ 2
+// SHORTWCHAR: #define __WCHAR_MAX__ 65535U
+// SHORTWCHAR: #define __WCHAR_TYPE__ unsigned short
+// SHORTWCHAR: #define __WCHAR_WIDTH__ 16
+//
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-none < /dev/null | FileCheck -check-prefix ARM %s
//
// ARM:#define __APCS_32__ 1