diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-03-15 17:27:48 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-03-15 17:27:48 +0000 |
commit | b03a4c23c202f37402eadc25aa19e3f9756c50c4 (patch) | |
tree | 440b8e5e126a9c1d2a3ebb27ec96e3482f5c062a | |
parent | 024932fc77ef34522f127ea8a70869a435a47341 (diff) | |
download | bcm5719-llvm-b03a4c23c202f37402eadc25aa19e3f9756c50c4.tar.gz bcm5719-llvm-b03a4c23c202f37402eadc25aa19e3f9756c50c4.zip |
Don't poke into redefined 'id' type looking for a property
declaration as this results in a confusing error message,
instead of message related to missing property declaration.
// rdar://9106929
llvm-svn: 127682
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 5 | ||||
-rw-r--r-- | clang/test/SemaObjC/property-lookup-in-id.m | 33 |
2 files changed, 36 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index d0528b1bc32..7ef3348bdc2 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3905,8 +3905,9 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr, MemberLoc, BaseExpr)); } } - - if (ShouldTryAgainWithRedefinitionType(*this, BaseExpr)) + // Use of id.member can only be for a property reference. Do not + // use the 'id' redefinition in this case. + if (IsArrow && ShouldTryAgainWithRedefinitionType(*this, BaseExpr)) return LookupMemberExpr(R, BaseExpr, IsArrow, OpLoc, SS, ObjCImpDecl, HasTemplateArgs); diff --git a/clang/test/SemaObjC/property-lookup-in-id.m b/clang/test/SemaObjC/property-lookup-in-id.m new file mode 100644 index 00000000000..389e0bdba70 --- /dev/null +++ b/clang/test/SemaObjC/property-lookup-in-id.m @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// rdar://9106929 + +typedef struct objc_class *Class; + +typedef struct objc_object { + Class isa; +} *id; + + +typedef struct __FSEventStream* FSEventStreamRef; + +extern id NSApp; + +@interface FileSystemMonitor { + + FSEventStreamRef fsEventStream; +} +@property(assign) FSEventStreamRef fsEventStream; + +@end + +@implementation FileSystemMonitor +@synthesize fsEventStream; + +- (void)startFSEventGathering:(id)sender +{ + fsEventStream = [NSApp delegate].fsEventStream; // expected-warning {{warning: method '-delegate' not found (return type defaults to 'id')}} \ + // expected-error {{property 'fsEventStream' not found on object of type 'id'}} + +} +@end + |