QualType VoidTy;
QualType BoolTy;
QualType CharTy;
- QualType WCharTy; // [C++ 3.9.1p5]
+ QualType WCharTy; // [C++ 3.9.1p5], integer type in C99.
QualType SignedCharTy, ShortTy, IntTy, LongTy, LongLongTy;
QualType UnsignedCharTy, UnsignedShortTy, UnsignedIntTy, UnsignedLongTy;
QualType UnsignedLongLongTy;
/// in <stddef.h>. The sizeof operator requires this (C99 6.5.3.4p4).
QualType getSizeType() const;
- /// getWCharType - Return the unique type for "wchar_t" (C99 7.17), defined
- /// in <stddef.h>. Wide strings require this (C99 6.4.5p5).
- QualType getWCharType() const;
+ /// getWCharType - In C++, this returns the unique wchar_t type. In C99, this
+ /// returns a type compatible with the type defined in <stddef.h> as defined
+ /// by the target.
+ QualType getWCharType() const { return WCharTy; }
/// getSignedWCharType - Return the type of "signed wchar_t".
/// Used when in C++, as a GCC extension.
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);
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 {