[Lldb-commits] [lldb] r233795 - Correctly detect sign-ness of wchar_t

Tamas Berghammer tberghammer at google.com
Wed Apr 1 02:48:04 PDT 2015


Author: tberghammer
Date: Wed Apr  1 04:48:02 2015
New Revision: 233795

URL: http://llvm.org/viewvc/llvm-project?rev=233795&view=rev
Log:
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.

Modified:
    lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=233795&r1=233794&r2=233795&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Wed Apr  1 04:48:02 2015
@@ -904,7 +904,8 @@ ClangASTContext::GetBuiltinTypeForDWARFE
                 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 @@ ClangASTContext::GetBuiltinTypeForDWARFE
             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))





More information about the lldb-commits mailing list