[Lldb-commits] [lldb] r137392 - in /lldb/trunk/source: Expression/ClangExpressionDeclMap.cpp Symbol/ClangASTContext.cpp

Sean Callanan scallanan at apple.com
Thu Aug 11 16:56:13 PDT 2011


Author: spyffe
Date: Thu Aug 11 18:56:13 2011
New Revision: 137392

URL: http://llvm.org/viewvc/llvm-project?rev=137392&view=rev
Log:
Fixed LLDB's handling of ElaboratedTypes, which was
causing problems with printing the values of persistent
variables with struct types.

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

Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=137392&r1=137391&r2=137392&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Thu Aug 11 18:56:13 2011
@@ -2012,13 +2012,8 @@
     {
         ExternalASTSource *external_source = original_ctx->getExternalSource();
         
-        if (!external_source)
-            return ELR_Failure;
-        
-        if (!original_tag_decl)
-            return ELR_Failure;
-        
-        external_source->CompleteType (original_tag_decl);
+        if (external_source)
+            external_source->CompleteType (original_tag_decl);
     }
     
     DeclContext *original_decl_context = dyn_cast<DeclContext>(original_decl);

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=137392&r1=137391&r2=137392&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Aug 11 18:56:13 2011
@@ -143,6 +143,9 @@
 
     case clang::Type::Typedef:
         return GetCompleteQualType (ast, cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType());
+    
+    case clang::Type::Elaborated:
+        return GetCompleteQualType (ast, cast<ElaboratedType>(qual_type)->getNamedType());
 
     default:
         break;
@@ -1143,6 +1146,9 @@
 
     case clang::Type::Typedef:
         return ClangASTContext::SetHasExternalStorage (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), has_extern);
+    
+    case clang::Type::Elaborated:
+        return ClangASTContext::SetHasExternalStorage (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), has_extern);
 
     default:
         break;
@@ -2131,7 +2137,10 @@
             *pointee_or_element_clang_type = cast<EnumType>(qual_type)->getDecl()->getIntegerType().getAsOpaquePtr();
         return eTypeIsEnumeration | eTypeHasValue;
 
-    case clang::Type::Elaborated:                       return 0;
+    case clang::Type::Elaborated:
+        return ClangASTContext::GetTypeInfo (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(),
+                                             ast, 
+                                             pointee_or_element_clang_type);
     case clang::Type::ExtVector:                        return eTypeHasChildren | eTypeIsVector;
     case clang::Type::FunctionProto:                    return eTypeIsFuncPrototype | eTypeHasValue;
     case clang::Type::FunctionNoProto:                  return eTypeIsFuncPrototype | eTypeHasValue;
@@ -2205,7 +2214,8 @@
     case clang::Type::ObjCObject:
     case clang::Type::ObjCInterface:
         return true;
-
+    case clang::Type::Elaborated:
+        return ClangASTContext::IsAggregateType (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
     case clang::Type::Typedef:
         return ClangASTContext::IsAggregateType (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
 
@@ -2374,6 +2384,12 @@
                                                         cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), 
                                                         omit_empty_base_classes);
         break;
+        
+    case clang::Type::Elaborated:
+        num_children = ClangASTContext::GetNumChildren (ast, 
+                                                        cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(),
+                                                        omit_empty_base_classes);
+        break;
 
     default:
         break;
@@ -2453,12 +2469,12 @@
     case clang::Type::UnresolvedUsing:          return 0;
     case clang::Type::Paren:                    return 0;
     case clang::Type::Typedef:                  return ClangASTContext::GetNumPointeeChildren (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
+    case clang::Type::Elaborated:               return ClangASTContext::GetNumPointeeChildren (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
     case clang::Type::TypeOfExpr:               return 0;
     case clang::Type::TypeOf:                   return 0;
     case clang::Type::Decltype:                 return 0;
     case clang::Type::Record:                   return 0;
     case clang::Type::Enum:                     return 1;
-    case clang::Type::Elaborated:               return 1;
     case clang::Type::TemplateTypeParm:         return 1;
     case clang::Type::SubstTemplateTypeParm:    return 1;
     case clang::Type::TemplateSpecialization:   return 1;
@@ -2933,6 +2949,23 @@
                                              child_is_base_class,
                                              child_is_deref_of_parent);
             break;
+    
+        case clang::Type::Elaborated:
+            return GetChildClangTypeAtIndex (exe_ctx,
+                                             ast,
+                                             parent_name,
+                                             cast<ElaboratedType>(parent_qual_type)->getNamedType().getAsOpaquePtr(),
+                                             idx,
+                                             transparent_pointers,
+                                             omit_empty_base_classes,
+                                             ignore_array_bounds,
+                                             child_name,
+                                             child_byte_size,
+                                             child_byte_offset,
+                                             child_bitfield_bit_size,
+                                             child_bitfield_bit_offset,
+                                             child_is_base_class,
+                                             child_is_deref_of_parent); 
 
         default:
             break;
@@ -3665,7 +3698,7 @@
     case clang::Type::Record:                   return cast<RecordType>(qual_type)->getDecl();
     case clang::Type::Enum:                     return cast<EnumType>(qual_type)->getDecl();
     case clang::Type::Typedef:                  return ClangASTContext::GetDeclContextForType (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
-
+    case clang::Type::Elaborated:               return ClangASTContext::GetDeclContextForType (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
     case clang::Type::TypeOfExpr:               break;
     case clang::Type::TypeOf:                   break;
     case clang::Type::Decltype:                 break;
@@ -3678,7 +3711,6 @@
     case clang::Type::PackExpansion:            break;
     case clang::Type::UnresolvedUsing:          break;
     case clang::Type::Paren:                    break;
-    case clang::Type::Elaborated:               break;
     case clang::Type::Attributed:               break;
     case clang::Type::Auto:                     break;
     case clang::Type::InjectedClassName:        break;
@@ -4119,7 +4151,10 @@
                 
             case clang::Type::Typedef:
                 return ClangASTContext::IsPossibleDynamicType (ast, cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), dynamic_pointee_type);
-                
+            
+            case clang::Type::Elaborated:
+                return ClangASTContext::IsPossibleDynamicType (ast, cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), dynamic_pointee_type);
+            
             default:
                 break;
         }
@@ -4250,6 +4285,9 @@
             case clang::Type::Typedef:
                 return ClangASTContext::IsPossibleCPlusPlusDynamicType (ast, cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), dynamic_pointee_type);
 
+            case clang::Type::Elaborated:
+                return ClangASTContext::IsPossibleCPlusPlusDynamicType (ast, cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
+
             default:
                 break;
         }
@@ -4386,6 +4424,8 @@
         return true;
     case clang::Type::Typedef:
         return ClangASTContext::IsPointerOrReferenceType (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
+    case clang::Type::Elaborated:
+        return ClangASTContext::IsPointerOrReferenceType (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
     default:
         break;
     }
@@ -4452,6 +4492,8 @@
             return true;
         case clang::Type::Typedef:
             return ClangASTContext::IsPointerType (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(), target_type);
+        case clang::Type::Elaborated:
+            return ClangASTContext::IsPointerType (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(), target_type);
         default:
             break;
         }
@@ -4636,6 +4678,8 @@
             break;
         case clang::Type::Typedef:
             return ClangASTContext::IsFunctionPointerType (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
+        case clang::Type::Elaborated:
+            return ClangASTContext::IsFunctionPointerType (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
 
         case clang::Type::LValueReference:
         case clang::Type::RValueReference:
@@ -4669,7 +4713,9 @@
 
         case clang::Type::Typedef:
             return ClangASTContext::GetArraySize(cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr());
-            break;
+            
+        case clang::Type::Elaborated:
+            return ClangASTContext::GetArraySize(cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr());
                 
         default:
             break;
@@ -4724,6 +4770,11 @@
         return ClangASTContext::IsArrayType (cast<TypedefType>(qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(),
                                              member_type, 
                                              size);
+    
+    case clang::Type::Elaborated:
+        return ClangASTContext::IsArrayType (cast<ElaboratedType>(qual_type)->getNamedType().getAsOpaquePtr(),
+                                             member_type,
+                                             size);
     }
     return false;
 }





More information about the lldb-commits mailing list