]> granicus.if.org Git - clang/commitdiff
When importing an ObjCInterfaceDecl, ensure that
authorSean Callanan <scallanan@apple.com>
Fri, 11 Nov 2011 17:39:52 +0000 (17:39 +0000)
committerSean Callanan <scallanan@apple.com>
Fri, 11 Nov 2011 17:39:52 +0000 (17:39 +0000)
superclass information is imported before validating
it.  This fixes spurious "incompatible superclasses"
errors in LLDB.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144393 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTImporter.cpp

index e03b154e642312bf3101e3d4dd4f6f697d6eee04..f7a55a1474fe5e0e7c974c96092da3ac50c8ad79 100644 (file)
@@ -3220,6 +3220,17 @@ Decl *ASTNodeImporter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {
 
     // Check for consistency of superclasses.
     DeclarationName FromSuperName, ToSuperName;
+    
+    // If the superclass hasn't been imported yet, do so before checking.
+    ObjCInterfaceDecl *DSuperClass = D->getSuperClass();
+    ObjCInterfaceDecl *ToIfaceSuperClass = ToIface->getSuperClass();
+    
+    if (DSuperClass && !ToIfaceSuperClass) {
+      Decl *ImportedSuperClass = Importer.Import(DSuperClass);
+      ObjCInterfaceDecl *ImportedSuperIface = cast<ObjCInterfaceDecl>(ImportedSuperClass);
+      ToIface->setSuperClass(ImportedSuperIface);
+    }
+
     if (D->getSuperClass())
       FromSuperName = Importer.Import(D->getSuperClass()->getDeclName());
     if (ToIface->getSuperClass())