diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-01-12 00:18:35 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-01-12 00:18:35 +0000 |
commit | 4f8cb1e83a0f17d17aac25bb041d195d158bd08b (patch) | |
tree | 693d545abaac7e8256ed258211ec9bb18b08da26 | |
parent | f88480363e3f3c5d635eef2e7b52dc29f56351d0 (diff) | |
download | bcm5719-llvm-4f8cb1e83a0f17d17aac25bb041d195d158bd08b.tar.gz bcm5719-llvm-4f8cb1e83a0f17d17aac25bb041d195d158bd08b.zip |
objective-c: fixes a regression in looking up names
in class extensions and categories by recent refactoring
of objc class ASTs. // rdar://1066654
llvm-svn: 147982
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 7 | ||||
-rw-r--r-- | clang/test/SemaObjC/ContClassPropertyLookup.m | 20 |
2 files changed, 25 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index f30f1fa5be6..dc8d6ec8cf7 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1255,8 +1255,11 @@ ObjCInterfaceDecl *Sema::getObjCInterfaceDecl(IdentifierInfo *&Id, Id = IDecl->getIdentifier(); } } - - return dyn_cast_or_null<ObjCInterfaceDecl>(IDecl); + ObjCInterfaceDecl *Def = dyn_cast_or_null<ObjCInterfaceDecl>(IDecl); + // This routine must always return a class definition, if any. + if (Def && Def->getDefinition()) + Def = Def->getDefinition(); + return Def; } /// getNonFieldDeclScope - Retrieves the innermost scope, starting diff --git a/clang/test/SemaObjC/ContClassPropertyLookup.m b/clang/test/SemaObjC/ContClassPropertyLookup.m index b3459c13e41..2bc376f696f 100644 --- a/clang/test/SemaObjC/ContClassPropertyLookup.m +++ b/clang/test/SemaObjC/ContClassPropertyLookup.m @@ -16,3 +16,23 @@ @implementation MyObject @synthesize foo = _foo; @end + +// rdar://10666594 +@interface MPMediaItem +@end + +@class MPMediaItem; + +@interface MPMediaItem () +@property (nonatomic, readonly) id title; +@end + +@interface PodcastEpisodesViewController +@end + +@implementation PodcastEpisodesViewController +- (id) Meth { + MPMediaItem *episode; + return episode.title; +} +@end |