From: Argyrios Kyrtzidis Date: Wed, 19 Oct 2011 02:25:16 +0000 (+0000) Subject: Don't forget to complete the objc interface before asking for information, X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c81c2a5915878e4aa6908a097290fd47fb3a154;p=clang Don't forget to complete the objc interface before asking for information, otherwise lldb will suffer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142471 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 0481f9cdf5..7eb2688134 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -237,6 +237,9 @@ const ObjCCategoryDecl* ObjCCategoryDecl::getNextClassExtension() const { ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable(IdentifierInfo *ID, ObjCInterfaceDecl *&clsDeclared) { + if (ExternallyCompleted) + LoadExternalDefinition(); + ObjCInterfaceDecl* ClassDecl = this; while (ClassDecl != NULL) { if (ObjCIvarDecl *I = ClassDecl->getIvarDecl(ID)) { @@ -261,6 +264,9 @@ ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable(IdentifierInfo *ID, /// the it returns NULL. ObjCInterfaceDecl *ObjCInterfaceDecl::lookupInheritedClass( const IdentifierInfo*ICName) { + if (ExternallyCompleted) + LoadExternalDefinition(); + ObjCInterfaceDecl* ClassDecl = this; while (ClassDecl != NULL) { if (ClassDecl->getIdentifier() == ICName) @@ -315,6 +321,9 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel, ObjCMethodDecl *ObjCInterfaceDecl::lookupPrivateMethod( const Selector &Sel, bool Instance) { + if (ExternallyCompleted) + LoadExternalDefinition(); + ObjCMethodDecl *Method = 0; if (ObjCImplementationDecl *ImpDecl = getImplementation()) Method = Instance ? ImpDecl->getInstanceMethod(Sel) diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 47c8f540e4..3b4a40b51a 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1934,7 +1934,8 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S, if (LookForIvars) { IFace = CurMethod->getClassInterface(); ObjCInterfaceDecl *ClassDeclared; - if (ObjCIvarDecl *IV = IFace->lookupInstanceVariable(II, ClassDeclared)) { + ObjCIvarDecl *IV = 0; + if (IFace && (IV = IFace->lookupInstanceVariable(II, ClassDeclared))) { // Diagnose using an ivar in a class method. if (IsClassMethod) return ExprError(Diag(Loc, diag::error_ivar_use_in_class_method)