summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-07-30 16:59:05 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-07-30 16:59:05 +0000
commit7b70eb4bb190541e999c434df737277bc5b55777 (patch)
tree3a2e949748d3d7823083562bad3a73e7115c4e6f /clang/lib/Sema/SemaExpr.cpp
parented5b6899ab52ec19721b6432cc6c33dca48ebd24 (diff)
downloadbcm5719-llvm-7b70eb4bb190541e999c434df737277bc5b55777.tar.gz
bcm5719-llvm-7b70eb4bb190541e999c434df737277bc5b55777.zip
Tighten the rules when deciding if an ivar must be
auto-synthesized (nonfragile-abi2 specific). Fixes radar 8251648. llvm-svn: 109866
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index a934adfb0c4..1dffa0e64c2 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/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);
}
OpenPOWER on IntegriCloud