diff options
author | Steve Naroff <snaroff@apple.com> | 2008-06-05 13:55:23 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-06-05 13:55:23 +0000 |
commit | f9c65246dd3512d381f9f052b8b7be9459eef063 (patch) | |
tree | 80bd2d676b4e91b511a83f1c03d27f070e1bce5d /clang/lib/AST/DeclObjC.cpp | |
parent | 3f8de8b130740282b97a2ca632f94b1b371789c0 (diff) | |
download | bcm5719-llvm-f9c65246dd3512d381f9f052b8b7be9459eef063.tar.gz bcm5719-llvm-f9c65246dd3512d381f9f052b8b7be9459eef063.zip |
Fix <rdar://problem/5987482> clang on xcode: null dereference in Sema::ActOnMemberReferenceExpr.
In addition to fixing the crasher, this commit fixes further improves property lookup (by searching protocols of qualified interfaces..."NSObject <prot>").
llvm-svn: 52001
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index e493d27ac33..6536df6e1e1 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -157,6 +157,14 @@ ObjCPropertyDecl * if (property) return property; } + // Look through protocols. + for (ObjCInterfaceDecl::protocol_iterator I = protocol_begin(), + E = protocol_end(); I != E; ++I) { + ObjCProtocolDecl *Protocol = *I; + ObjCPropertyDecl *property = Protocol->FindPropertyDeclaration(PropertyId); + if (property) + return property; + } if (getSuperClass()) return getSuperClass()->FindPropertyDeclaration(PropertyId); return 0; @@ -397,6 +405,20 @@ ObjCCategoryDecl::FindPropertyDeclaration(IdentifierInfo *PropertyId) const { return 0; } +/// FindPropertyDeclaration - Finds declaration of the property given its name +/// in 'PropertyId' and returns it. It returns 0, if not found. +/// +ObjCPropertyDecl * +ObjCProtocolDecl::FindPropertyDeclaration(IdentifierInfo *PropertyId) const { + for (ObjCProtocolDecl::classprop_iterator I = classprop_begin(), + E = classprop_end(); I != E; ++I) { + ObjCPropertyDecl *property = *I; + if (property->getIdentifier() == PropertyId) + return property; + } + return 0; +} + ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable( IdentifierInfo *ID, ObjCInterfaceDecl *&clsDeclared) { ObjCInterfaceDecl* ClassDecl = this; |