diff options
| author | Hans Wennborg <hans@hanshq.net> | 2013-05-10 10:08:40 +0000 |
|---|---|---|
| committer | Hans Wennborg <hans@hanshq.net> | 2013-05-10 10:08:40 +0000 |
| commit | 0d81e019169b544459992638047110cc630c36e4 (patch) | |
| tree | fc08954959bf45061e1451e7219dd6584a0a7531 /clang/lib/Analysis | |
| parent | a6645e8b8f9c4805c3808e55fa17575c0360baaf (diff) | |
| download | bcm5719-llvm-0d81e019169b544459992638047110cc630c36e4.tar.gz bcm5719-llvm-0d81e019169b544459992638047110cc630c36e4.zip | |
Add support for __wchar_t in -fms-extensions mode.
MSVC provides __wchar_t. This is the same as the built-in wchar_t type
from C++, but it is also available with -fno-wchar and in C.
The commit changes ASTContext to have two different types for this:
- WCharTy is the built-in type used for wchar_t in C++ and __wchar_t.
- WideCharTy is the type of a wide character literal. In C++ this is
the same as WCharTy, and in C it is an integer type compatible with
the type in <stddef.h>.
This fixes PR15815.
llvm-svn: 181587
Diffstat (limited to 'clang/lib/Analysis')
| -rw-r--r-- | clang/lib/Analysis/FormatString.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Analysis/PrintfFormatString.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/Analysis/ScanfFormatString.cpp | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Analysis/FormatString.cpp b/clang/lib/Analysis/FormatString.cpp index ad0dce4444b..382be24dca7 100644 --- a/clang/lib/Analysis/FormatString.cpp +++ b/clang/lib/Analysis/FormatString.cpp @@ -334,7 +334,7 @@ bool ArgType::matchesType(ASTContext &C, QualType argTy) const { return false; QualType pointeeTy = C.getCanonicalType(PT->getPointeeType()).getUnqualifiedType(); - return pointeeTy == C.getWCharType(); + return pointeeTy == C.getWideCharType(); } case WIntTy: { @@ -398,7 +398,7 @@ QualType ArgType::getRepresentativeType(ASTContext &C) const { Res = C.getPointerType(C.CharTy); break; case WCStrTy: - Res = C.getPointerType(C.getWCharType()); + Res = C.getPointerType(C.getWideCharType()); break; case ObjCPointerTy: Res = C.ObjCBuiltinIdTy; diff --git a/clang/lib/Analysis/PrintfFormatString.cpp b/clang/lib/Analysis/PrintfFormatString.cpp index 8f151b9358e..60f9517e7f9 100644 --- a/clang/lib/Analysis/PrintfFormatString.cpp +++ b/clang/lib/Analysis/PrintfFormatString.cpp @@ -372,7 +372,7 @@ ArgType PrintfSpecifier::getArgType(ASTContext &Ctx, case ConversionSpecifier::CArg: if (IsObjCLiteral) return ArgType(Ctx.UnsignedShortTy, "unichar"); - return ArgType(Ctx.WCharTy, "wchar_t"); + return ArgType(Ctx.WideCharTy, "wchar_t"); case ConversionSpecifier::pArg: return ArgType::CPointerTy; case ConversionSpecifier::ObjCObjArg: diff --git a/clang/lib/Analysis/ScanfFormatString.cpp b/clang/lib/Analysis/ScanfFormatString.cpp index 2dbc9e49488..676b68f391c 100644 --- a/clang/lib/Analysis/ScanfFormatString.cpp +++ b/clang/lib/Analysis/ScanfFormatString.cpp @@ -311,7 +311,7 @@ ArgType ScanfSpecifier::getArgType(ASTContext &Ctx) const { case LengthModifier::None: return ArgType::PtrTo(ArgType::AnyCharTy); case LengthModifier::AsLong: - return ArgType::PtrTo(ArgType(Ctx.getWCharType(), "wchar_t")); + return ArgType::PtrTo(ArgType(Ctx.getWideCharType(), "wchar_t")); case LengthModifier::AsAllocate: case LengthModifier::AsMAllocate: return ArgType::PtrTo(ArgType::CStrTy); @@ -323,7 +323,7 @@ ArgType ScanfSpecifier::getArgType(ASTContext &Ctx) const { // FIXME: Mac OS X specific? switch (LM.getKind()) { case LengthModifier::None: - return ArgType::PtrTo(ArgType(Ctx.getWCharType(), "wchar_t")); + return ArgType::PtrTo(ArgType(Ctx.getWideCharType(), "wchar_t")); case LengthModifier::AsAllocate: case LengthModifier::AsMAllocate: return ArgType::PtrTo(ArgType(ArgType::WCStrTy, "wchar_t *")); |

