[Lldb-commits] [lldb] r148488 - /lldb/trunk/source/Symbol/ClangASTImporter.cpp

Sean Callanan scallanan at apple.com
Thu Jan 19 12:23:06 CST 2012


Author: spyffe
Date: Thu Jan 19 12:23:06 2012
New Revision: 148488

URL: http://llvm.org/viewvc/llvm-project?rev=148488&view=rev
Log:
Fixed a problem where Objective-C classes that were
originally imported from symbols for the expression
parser didn't get their superclasses set properly.

Modified:
    lldb/trunk/source/Symbol/ClangASTImporter.cpp

Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=148488&r1=148487&r2=148488&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Thu Jan 19 12:23:06 2012
@@ -312,6 +312,44 @@
     ASTImporter::Imported(from, to);
     
     ImportDefinition(from);
+    
+    // If we're dealing with an Objective-C class, ensure that the inheritance has
+    // been set up correctly.  The ASTImporter may not do this correctly if the 
+    // class was originally sourced from symbols.
+    
+    if (ObjCInterfaceDecl *to_objc_interface = dyn_cast<ObjCInterfaceDecl>(to))
+    {
+        do
+        {
+            ObjCInterfaceDecl *to_superclass = to_objc_interface->getSuperClass();
+
+            if (to_superclass)
+                break; // we're not going to override it if it's set
+            
+            ObjCInterfaceDecl *from_objc_interface = dyn_cast<ObjCInterfaceDecl>(from);
+            
+            if (!from_objc_interface)
+                break;
+            
+            ObjCInterfaceDecl *from_superclass = from_objc_interface->getSuperClass();
+            
+            if (!from_superclass)
+                break;
+            
+            Decl *imported_from_superclass_decl = Import(from_superclass);
+                
+            if (!imported_from_superclass_decl)
+                break;
+                
+            ObjCInterfaceDecl *imported_from_superclass = dyn_cast<ObjCInterfaceDecl>(imported_from_superclass_decl);
+            
+            if (!imported_from_superclass)
+                break;
+            
+            to_objc_interface->setSuperClass(imported_from_superclass);
+        }
+        while (0);
+    }
 }
 
 clang::Decl 




More information about the lldb-commits mailing list