According to language standards, the wchar_t type is
- a library provided type in C
- a native type in C++.
There are C++ compilers allowing users to enable/disable the native support. For instance, MSVC has option /Zc:wchar_t. Even though the default in newer versions of MSVC is to enable wchar_t support, there is much code in the real world that will only work if this is disabled
(e.g., Qt X.Y.Z with X < 5).
The attached simple patch adds flag WChar to LangOptions.
The flag is similar to Bool: if set, the native wchar_t type is supported (i.e., wchar_t will be lexed as a keyword), otherwise it won't be supported (i.e., it will be a normal identifier). Currently, the flag is initialized the same as CPlusPlus, so that the addition should cause no visible change.
The addition of this flag will be enough for people using clang as a set of libraries. For more "conventional" uses, it might be worth considering the addition of a suitable command line option to toggle the flag.
WChar.patch (3.92 KB)