[Lldb-commits] [lldb] r118003 - /lldb/trunk/source/Symbol/ClangASTContext.cpp

Greg Clayton gclayton at apple.com
Mon Nov 1 20:48:39 PDT 2010


Author: gclayton
Date: Mon Nov  1 22:48:39 2010
New Revision: 118003

URL: http://llvm.org/viewvc/llvm-project?rev=118003&view=rev
Log:
Fixed cases where we were translating "long long" types to use the "long"
types when they are the same size. The new code will use the correct type 
now when converting DWARF built-in types into clang types.


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=118003&r1=118002&r2=118003&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Mon Nov  1 22:48:39 2010
@@ -521,49 +521,40 @@
         case DW_ATE_signed:
             if (type_name)
             {
-                if (streq(type_name, "int") ||
-                    streq(type_name, "signed int"))
+                if (strstr(type_name, "long long"))
                 {
-                    if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->IntTy))
-                        return ast_context->IntTy.getAsOpaquePtr();
-                    if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->Int128Ty))
-                        return ast_context->Int128Ty.getAsOpaquePtr();
+                    if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->LongLongTy))
+                        return ast_context->LongLongTy.getAsOpaquePtr();
                 }
-
-                if (streq(type_name, "long int") ||
-                    streq(type_name, "long long int") ||
-                    streq(type_name, "signed long long"))
+                else if (strstr(type_name, "long"))
                 {
                     if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->LongTy))
                         return ast_context->LongTy.getAsOpaquePtr();
-                    if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->LongLongTy))
-                        return ast_context->LongLongTy.getAsOpaquePtr();
                 }
-
-                if (streq(type_name, "short") ||
-                    streq(type_name, "short int") ||
-                    streq(type_name, "signed short") ||
-                    streq(type_name, "short signed int"))
+                else if (strstr(type_name, "short"))
                 {
                     if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->ShortTy))
                         return ast_context->ShortTy.getAsOpaquePtr();
                 }
-
-                if (streq(type_name, "char") ||
-                    streq(type_name, "signed char"))
+                else if (strstr(type_name, "char"))
                 {
                     if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->CharTy))
                         return ast_context->CharTy.getAsOpaquePtr();
                     if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->SignedCharTy))
                         return ast_context->SignedCharTy.getAsOpaquePtr();
                 }
-
-                if (streq(type_name, "wchar_t"))
+                else if (strstr(type_name, "int"))
+                {
+                    if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->IntTy))
+                        return ast_context->IntTy.getAsOpaquePtr();
+                    if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->Int128Ty))
+                        return ast_context->Int128Ty.getAsOpaquePtr();
+                }
+                else if (streq(type_name, "wchar_t"))
                 {
                     if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->WCharTy))
                         return ast_context->WCharTy.getAsOpaquePtr();
                 }
-
             }
             // We weren't able to match up a type name, just search by size
             if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->CharTy))
@@ -598,36 +589,33 @@
         case DW_ATE_unsigned:
             if (type_name)
             {
-                if (streq(type_name, "unsigned int"))
+                if (strstr(type_name, "long long"))
                 {
-                    if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedIntTy))
-                        return ast_context->UnsignedIntTy.getAsOpaquePtr();
-                    if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedInt128Ty))
-                        return ast_context->UnsignedInt128Ty.getAsOpaquePtr();
+                    if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedLongLongTy))
+                        return ast_context->UnsignedLongLongTy.getAsOpaquePtr();
                 }
-
-                if (streq(type_name, "unsigned int") ||
-                    streq(type_name, "long unsigned int") ||
-                    streq(type_name, "unsigned long long"))
+                else if (strstr(type_name, "long"))
                 {
                     if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedLongTy))
                         return ast_context->UnsignedLongTy.getAsOpaquePtr();
-                    if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedLongLongTy))
-                        return ast_context->UnsignedLongLongTy.getAsOpaquePtr();
                 }
-
-                if (streq(type_name, "unsigned short") ||
-                    streq(type_name, "short unsigned int"))
+                else if (strstr(type_name, "short"))
                 {
                     if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedShortTy))
                         return ast_context->UnsignedShortTy.getAsOpaquePtr();
                 }
-                if (streq(type_name, "unsigned char"))
+                else if (strstr(type_name, "char"))
                 {
                     if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedCharTy))
                         return ast_context->UnsignedCharTy.getAsOpaquePtr();
                 }
-
+                else if (strstr(type_name, "int"))
+                {
+                    if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedIntTy))
+                        return ast_context->UnsignedIntTy.getAsOpaquePtr();
+                    if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedInt128Ty))
+                        return ast_context->UnsignedInt128Ty.getAsOpaquePtr();
+                }
             }
             // We weren't able to match up a type name, just search by size
             if (QualTypeMatchesBitSize (bit_size, ast_context, ast_context->UnsignedCharTy))





More information about the lldb-commits mailing list