This patch removes the SymbolFileSymtab support 
for reporting class types from Objective-C runtime
class symbols.  Instead, LLDB now queries the 
Objective-C runtime for class types.

We have also added a (minimal) Objective-C runtime
type vendor for Objective-C runtime version 1, to 
prevent regressions when calling class methods in
the V1 runtime.

Other components of this fix include:

- We search the Objective-C runtime in a few more
  places.

- We enable enumeration of all members of
  Objective-C classes, which Clang does in certain
  circumstances.

- SBTarget::FindFirstType and SBTarget::FindTypes
  now query the Objective-C runtime as needed.

- I fixed several test cases.

<rdar://problem/12885034>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@170601 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangASTSource.cpp b/source/Expression/ClangASTSource.cpp
index 2bce509..8d8fa6e 100644
--- a/source/Expression/ClangASTSource.cpp
+++ b/source/Expression/ClangASTSource.cpp
@@ -681,7 +681,7 @@
             if (!copied_type)
             {                
                 if (log)
-                    log->Printf("  CAS::FEVD[%u] - Couldn't export the type for a constant integer result",
+                    log->Printf("  CAS::FEVD[%u] - Couldn't export a type",
                                 current_id);
                     
                 break;
@@ -689,6 +689,63 @@
                 
             context.AddTypeDecl(copied_type);
         }
+        else
+        {
+            do
+            {
+                // Couldn't find any types elsewhere.  Try the Objective-C runtime if one exists.
+                
+                lldb::ProcessSP process(m_target->GetProcessSP());
+                
+                if (!process)
+                    break;
+                
+                ObjCLanguageRuntime *language_runtime(process->GetObjCLanguageRuntime());
+                
+                if (!language_runtime)
+                    break;
+                
+                TypeVendor *type_vendor = language_runtime->GetTypeVendor();
+                
+                if (!type_vendor)
+                    break;
+                
+                bool append = false;
+                uint32_t max_matches = 1;
+                std::vector <ClangASTType> types;
+                
+                if (!type_vendor->FindTypes(name,
+                                            append,
+                                            max_matches,
+                                            types))
+                    break;
+                
+                if (log)
+                {                    
+                    log->Printf("  CAS::FEVD[%u] Matching type found for \"%s\" in the runtime",
+                                current_id,
+                                name.GetCString());
+                }
+                
+                const clang::Type *runtime_clang_type = QualType::getFromOpaquePtr(types[0].GetOpaqueQualType()).getTypePtr();
+                
+                clang::QualType runtime_qual_type(runtime_clang_type, 0);
+                
+                void *copied_type = GuardedCopyType(m_ast_context, type_vendor->GetClangASTContext(), runtime_qual_type.getAsOpaquePtr());
+                
+                if (!copied_type)
+                {
+                    if (log)
+                        log->Printf("  CAS::FEVD[%u] - Couldn't export a type from the runtime",
+                                    current_id);
+                    
+                    break;
+                }
+                
+                context.AddTypeDecl(copied_type);
+            }
+            while(0);
+        }
         
     } while(0);
 }
@@ -1076,6 +1133,9 @@
         
         ObjCLanguageRuntime *language_runtime(process->GetObjCLanguageRuntime());
         
+        if (!language_runtime)
+            break;
+        
         TypeVendor *type_vendor = language_runtime->GetTypeVendor();
         
         if (!type_vendor)