From c63f1c5ab65b0318a0daf85bf02b936a07dd1921 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Mon, 3 Jan 2011 18:08:02 +0000 Subject: [PATCH] Guard lazy synthesis of provisional ivars under the new -fobjc-default-synthesize-properties flag. llvm-svn: 122757 --- clang/lib/Sema/SemaExpr.cpp | 6 ++++-- clang/lib/Sema/SemaObjCProperty.cpp | 3 ++- clang/test/SemaObjC/provisional-ivar-lookup.m | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index e481e5ce211f..f0e204964692 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1470,7 +1470,8 @@ ExprResult Sema::ActOnIdExpression(Scope *S, Expr *Ex = E.takeAs(); if (Ex) return Owned(Ex); // Synthesize ivars lazily - if (getLangOptions().ObjCNonFragileABI2) { + if (getLangOptions().ObjCDefaultSynthProperties && + getLangOptions().ObjCNonFragileABI2) { if (SynthesizeProvisionalIvar(*this, R, II, NameLoc)) { if (const ObjCPropertyDecl *Property = canSynthesizeProvisionalIvar(II)) { @@ -1527,7 +1528,8 @@ ExprResult Sema::ActOnIdExpression(Scope *S, if (VarDecl *Var = R.getAsSingle()) { if (getLangOptions().ObjCNonFragileABI && IvarLookupFollowUp && - !getLangOptions().ObjCNonFragileABI2 && + !(getLangOptions().ObjCDefaultSynthProperties && + getLangOptions().ObjCNonFragileABI2) && Var->isFileVarDecl()) { ObjCPropertyDecl *Property = canSynthesizeProvisionalIvar(II); if (Property) { diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 65a447e2a1a3..6aa1c693bc98 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -559,7 +559,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, return 0; } IC->addPropertyImplementation(PIDecl); - if (getLangOptions().ObjCNonFragileABI2) { + if (getLangOptions().ObjCDefaultSynthProperties && + getLangOptions().ObjCNonFragileABI2) { // Diagnose if an ivar was lazily synthesdized due to a previous // use and if 1) property is @dynamic or 2) property is synthesized // but it requires an ivar of different name. diff --git a/clang/test/SemaObjC/provisional-ivar-lookup.m b/clang/test/SemaObjC/provisional-ivar-lookup.m index 526748538e0f..6d57885d61f7 100644 --- a/clang/test/SemaObjC/provisional-ivar-lookup.m +++ b/clang/test/SemaObjC/provisional-ivar-lookup.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -fobjc-nonfragile-abi2 -verify %s // rdar:// 8565343 @interface Foo {