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.
llvm-svn: 135455
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 9428cd5..77a1b3f 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/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");