Fixed the auto completion of objective C types with the new ExternalASTSource 
changes that recently happened.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123881 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Symbol/ClangASTContext.cpp b/source/Symbol/ClangASTContext.cpp
index 0ec29b9..b1cd6c5 100644
--- a/source/Symbol/ClangASTContext.cpp
+++ b/source/Symbol/ClangASTContext.cpp
@@ -118,8 +118,9 @@
                         external_ast_source->CompleteType (class_interface_decl);
                         is_forward_decl = class_interface_decl->isForwardDecl();
                     }
+                    return is_forward_decl == false;
                 }
-                return is_forward_decl;
+                return true;
             }
         }
         break;
@@ -1056,7 +1057,7 @@
             if (cxx_record_decl)
             {
                 cxx_record_decl->setHasExternalLexicalStorage (has_extern);
-                //cxx_record_decl->setHasExternalVisibleStorage (has_extern);
+                cxx_record_decl->setHasExternalVisibleStorage (has_extern);
                 return true;
             }
         }
@@ -1068,7 +1069,7 @@
             if (enum_decl)
             {
                 enum_decl->setHasExternalLexicalStorage (has_extern);
-                //enum_decl->setHasExternalVisibleStorage (has_extern);
+                enum_decl->setHasExternalVisibleStorage (has_extern);
                 return true;
             }
         }
@@ -1086,7 +1087,7 @@
                 if (class_interface_decl)
                 {
                     class_interface_decl->setHasExternalLexicalStorage (has_extern);
-                    //class_interface_decl->setHasExternalVisibleStorage (has_extern);
+                    class_interface_decl->setHasExternalVisibleStorage (has_extern);
                     return true;
                 }
             }
@@ -1459,7 +1460,16 @@
     cxx_method_decl->setParams (params, num_params);
     
     cxx_record_decl->addDecl (cxx_method_decl);
-    
+
+//    printf ("decl->isPolymorphic()             = %i\n", cxx_record_decl->isPolymorphic());
+//    printf ("decl->isAggregate()               = %i\n", cxx_record_decl->isAggregate());
+//    printf ("decl->isPOD()                     = %i\n", cxx_record_decl->isPOD());
+//    printf ("decl->isEmpty()                   = %i\n", cxx_record_decl->isEmpty());
+//    printf ("decl->isAbstract()                = %i\n", cxx_record_decl->isAbstract());
+//    printf ("decl->hasTrivialConstructor()     = %i\n", cxx_record_decl->hasTrivialConstructor());
+//    printf ("decl->hasTrivialCopyConstructor() = %i\n", cxx_record_decl->hasTrivialCopyConstructor());
+//    printf ("decl->hasTrivialCopyAssignment()  = %i\n", cxx_record_decl->hasTrivialCopyAssignment());
+//    printf ("decl->hasTrivialDestructor()      = %i\n", cxx_record_decl->hasTrivialDestructor());
     return cxx_method_decl;
 }
 
@@ -2120,7 +2130,7 @@
     case clang::Type::Complex: return 0;
 
     case clang::Type::Record:
-        if (ClangASTContext::GetCompleteType (ast, clang_type))
+        if (GetCompleteQualType (ast, qual_type))
         {
             const RecordType *record_type = cast<RecordType>(qual_type.getTypePtr());
             const RecordDecl *record_decl = record_type->getDecl();
@@ -2163,6 +2173,7 @@
 
     case clang::Type::ObjCObject:
     case clang::Type::ObjCInterface:
+        if (GetCompleteQualType (ast, qual_type))
         {
             ObjCObjectType *objc_class_type = dyn_cast<ObjCObjectType>(qual_type.getTypePtr());
             assert (objc_class_type);
@@ -2427,7 +2438,7 @@
             break;
 
         case clang::Type::Record:
-            if (ClangASTContext::GetCompleteType (ast, parent_clang_type))
+            if (GetCompleteQualType (ast, parent_qual_type))
             {
                 const RecordType *record_type = cast<RecordType>(parent_qual_type.getTypePtr());
                 const RecordDecl *record_decl = record_type->getDecl();
@@ -2517,6 +2528,7 @@
 
         case clang::Type::ObjCObject:
         case clang::Type::ObjCInterface:
+            if (GetCompleteQualType (ast, parent_qual_type))
             {
                 ObjCObjectType *objc_class_type = dyn_cast<ObjCObjectType>(parent_qual_type.getTypePtr());
                 assert (objc_class_type);
@@ -2958,7 +2970,7 @@
         switch (type_class)
         {
         case clang::Type::Record:
-            if (ClangASTContext::GetCompleteType (ast, clang_type))
+            if (GetCompleteQualType (ast, qual_type))
             {
                 const RecordType *record_type = cast<RecordType>(qual_type.getTypePtr());
                 const RecordDecl *record_decl = record_type->getDecl();
@@ -3047,6 +3059,7 @@
 
         case clang::Type::ObjCObject:
         case clang::Type::ObjCInterface:
+            if (GetCompleteQualType (ast, qual_type))
             {
                 StringRef name_sref(name);
                 ObjCObjectType *objc_class_type = dyn_cast<ObjCObjectType>(qual_type.getTypePtr());
@@ -3238,7 +3251,7 @@
         switch (type_class)
         {
         case clang::Type::Record:
-            if (ClangASTContext::GetCompleteType (ast, clang_type))
+            if (GetCompleteQualType (ast, qual_type))
             {
                 const RecordType *record_type = cast<RecordType>(qual_type.getTypePtr());
                 const RecordDecl *record_decl = record_type->getDecl();
@@ -3282,6 +3295,7 @@
 
         case clang::Type::ObjCObject:
         case clang::Type::ObjCInterface:
+            if (GetCompleteQualType (ast, qual_type))
             {
                 StringRef name_sref(name);
                 ObjCObjectType *objc_class_type = dyn_cast<ObjCObjectType>(qual_type.getTypePtr());
@@ -4354,8 +4368,7 @@
     if (clang_type == NULL)
         return false;
 
-    clang::QualType qual_type(clang::QualType::getFromOpaquePtr(clang_type));
-    return GetCompleteQualType (ast, qual_type);
+    return GetCompleteQualType (ast, clang::QualType::getFromOpaquePtr(clang_type));
 }