[Lldb-commits] [PATCH] Fix type detection for 'char' when it is unsigned

Tamas Berghammer tberghammer at google.com
Thu Mar 26 08:53:37 PDT 2015


Hi clayborg,

Fix type detection for 'char' when it is unsigned

A char can have signed or unsigned encoding. Previously we only
displayed the type of a variable as char if it had signed encoding. This
CL adds a check for reporting char type when it is specified by name and
the encoding is unsigned char.

http://reviews.llvm.org/D8636

Files:
  source/Symbol/ClangASTContext.cpp

Index: source/Symbol/ClangASTContext.cpp
===================================================================
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -1013,8 +1013,16 @@
                 if (QualTypeMatchesBitSize (bit_size, ast, ast->UnsignedInt128Ty))
                     return ClangASTType (ast, ast->UnsignedInt128Ty.getAsOpaquePtr());
                 break;
-                
+
             case DW_ATE_unsigned_char:
+                if (type_name)
+                {
+                    if (streq(type_name, "char"))
+                    {
+                        if (QualTypeMatchesBitSize (bit_size, ast, ast->CharTy))
+                            return ClangASTType (ast, ast->CharTy.getAsOpaquePtr());
+                    }
+                }
                 if (QualTypeMatchesBitSize (bit_size, ast, ast->UnsignedCharTy))
                     return ClangASTType (ast, ast->UnsignedCharTy.getAsOpaquePtr());
                 if (QualTypeMatchesBitSize (bit_size, ast, ast->UnsignedShortTy))

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8636.22726.patch
Type: text/x-patch
Size: 1050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150326/959d3412/attachment.bin>


More information about the lldb-commits mailing list