From: Fariborz Jahanian Date: Wed, 26 Jan 2011 00:57:01 +0000 (+0000) Subject: Tweak the rule for deciding if a provisional ivar is needed X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d0fbadd012ba0a3a23af7af56837b7ef9b0637ac;p=clang Tweak the rule for deciding if a provisional ivar is needed in default ivar synthesis. Fixes // rdar://8913053. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124258 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 9ebfb05933..3112ccb55f 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1354,7 +1354,8 @@ static ObjCIvarDecl *SynthesizeProvisionalIvar(Sema &SemaRef, LookForIvars = false; else LookForIvars = (Lookup.isSingleResult() && - Lookup.getFoundDecl()->isDefinedOutsideFunctionOrMethod()); + Lookup.getFoundDecl()->isDefinedOutsideFunctionOrMethod() && + (Lookup.getAsSingle() != 0)); if (!LookForIvars) return 0; diff --git a/test/SemaObjC/synth-provisional-ivars-1.m b/test/SemaObjC/synth-provisional-ivars-1.m new file mode 100644 index 0000000000..33de173cc1 --- /dev/null +++ b/test/SemaObjC/synth-provisional-ivars-1.m @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s +// rdar://8913053 + +typedef unsigned char BOOL; + +@interface MailApp +{ + BOOL _isAppleInternal; +} +@property(assign) BOOL isAppleInternal; +@end + +static BOOL isAppleInternal() {return 0; } + +@implementation MailApp + +- (BOOL)isAppleInternal { + return _isAppleInternal; +} + +- (void)setIsAppleInternal:(BOOL)flag { + _isAppleInternal= !!flag; +} + +- (void) Meth { + self.isAppleInternal = isAppleInternal(); +} +@end