diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-07-30 16:59:05 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-07-30 16:59:05 +0000 |
commit | 73f666ff7cd47c334aa051aa5a778a8fa71ae9ab (patch) | |
tree | 6f6591f89c81d9f8ee7ee12b8e7f55f88240ffab /lib | |
parent | 35f9a196ef897b9559de25aaecd957208f0b4f59 (diff) |
Tighten the rules when deciding if an ivar must be
auto-synthesized (nonfragile-abi2 specific).
Fixes radar 8251648.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109866 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index a934adfb0c..1dffa0e64c 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1005,8 +1005,8 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, } static ObjCPropertyDecl *OkToSynthesizeProvisionalIvar(Sema &SemaRef, - IdentifierInfo *II, - SourceLocation NameLoc) { + IdentifierInfo *II, + SourceLocation NameLoc) { ObjCMethodDecl *CurMeth = SemaRef.getCurMethodDecl(); ObjCInterfaceDecl *IDecl = CurMeth->getClassInterface(); if (!IDecl) @@ -1024,9 +1024,21 @@ static ObjCPropertyDecl *OkToSynthesizeProvisionalIvar(Sema &SemaRef, } static ObjCIvarDecl *SynthesizeProvisionalIvar(Sema &SemaRef, + LookupResult &Lookup, IdentifierInfo *II, SourceLocation NameLoc) { ObjCMethodDecl *CurMeth = SemaRef.getCurMethodDecl(); + bool LookForIvars; + if (Lookup.empty()) + LookForIvars = true; + else if (CurMeth->isClassMethod()) + LookForIvars = false; + else + LookForIvars = (Lookup.isSingleResult() && + Lookup.getFoundDecl()->isDefinedOutsideFunctionOrMethod()); + if (!LookForIvars) + return 0; + ObjCInterfaceDecl *IDecl = CurMeth->getClassInterface(); if (!IDecl) return 0; @@ -1122,7 +1134,7 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S, if (Ex) return Owned(Ex); // Synthesize ivars lazily if (getLangOptions().ObjCNonFragileABI2) { - if (SynthesizeProvisionalIvar(*this, II, NameLoc)) + if (SynthesizeProvisionalIvar(*this, R, II, NameLoc)) return ActOnIdExpression(S, SS, Id, HasTrailingLParen, isAddressOfOperand); } |