Implement a __WCHAR_UNSIGNED__ macro and use it to include WCHAR_MIN and
WCHAR_MAX in limits.h, thus solving the problem where the system header
thinks it knows better.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135455 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
index 9428cd5..77a1b3f 100644
--- a/lib/Frontend/InitPreprocessor.cpp
+++ b/lib/Frontend/InitPreprocessor.cpp
@@ -554,6 +554,9 @@
if (!TargetInfo::isTypeSigned(TI.getWIntType()))
Builder.defineMacro("__WINT_UNSIGNED__");
+ if (!TargetInfo::isTypeSigned(TI.getWCharType()))
+ Builder.defineMacro("__WCHAR_UNSIGNED__");
+
// Define exact-width integer types for stdint.h
Builder.defineMacro("__INT" + llvm::Twine(TI.getCharWidth()) + "_TYPE__",
"char");