Correctly detect sign-ness of wchar_t
The underlying type of wchar_t is not defined by the standard. This CL
add logic to correctly use the type specified for the current target
based on TargetInfo.
llvm-svn: 233795
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index a3eb0b6..c7eef43 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -904,7 +904,8 @@
if (type_name)
{
if (streq(type_name, "wchar_t") &&
- QualTypeMatchesBitSize (bit_size, ast, ast->WCharTy))
+ QualTypeMatchesBitSize (bit_size, ast, ast->WCharTy) &&
+ TargetInfo::isTypeSigned (getTargetInfo()->getWCharType()))
return ClangASTType (ast, ast->WCharTy.getAsOpaquePtr());
if (streq(type_name, "void") &&
QualTypeMatchesBitSize (bit_size, ast, ast->VoidTy))
@@ -961,6 +962,14 @@
case DW_ATE_unsigned:
if (type_name)
{
+ if (streq(type_name, "wchar_t"))
+ {
+ if (QualTypeMatchesBitSize (bit_size, ast, ast->WCharTy))
+ {
+ if (!TargetInfo::isTypeSigned (getTargetInfo()->getWCharType()))
+ return ClangASTType (ast, ast->WCharTy.getAsOpaquePtr());
+ }
+ }
if (strstr(type_name, "long long"))
{
if (QualTypeMatchesBitSize (bit_size, ast, ast->UnsignedLongLongTy))