make ASTContext::WCharTy a bit more sensical. In C++, it is a disctint type,
but in C99 it is just another int type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65590 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index f76d320..d059201 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -213,8 +213,10 @@
InitBuiltinType(DoubleTy, BuiltinType::Double);
InitBuiltinType(LongDoubleTy, BuiltinType::LongDouble);
- // C++ 3.9.1p5
- InitBuiltinType(WCharTy, BuiltinType::WChar);
+ if (LangOpts.CPlusPlus) // C++ 3.9.1p5
+ InitBuiltinType(WCharTy, BuiltinType::WChar);
+ else // C99
+ WCharTy = getFromTargetType(Target.getWCharType());
// Placeholder type for functions.
InitBuiltinType(OverloadTy, BuiltinType::Overload);
@@ -1437,16 +1439,6 @@
return getFromTargetType(Target.getSizeType());
}
-/// getWCharType - Return the unique type for "wchar_t" (C99 7.17), the
-/// width of characters in wide strings, The value is target dependent and
-/// needs to agree with the definition in <stddef.h>.
-QualType ASTContext::getWCharType() const {
- if (LangOpts.CPlusPlus)
- return WCharTy;
-
- return getFromTargetType(Target.getWCharType());
-}
-
/// getSignedWCharType - Return the type of "signed wchar_t".
/// Used when in C++, as a GCC extension.
QualType ASTContext::getSignedWCharType() const {