]> granicus.if.org Git - clang/commitdiff
Tigthen the condition for issung ivar shadowing
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 29 Jul 2010 16:53:53 +0000 (16:53 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 29 Jul 2010 16:53:53 +0000 (16:53 +0000)
variables to those in file scope (nonfragile-abi2).
Fixes radar 8248681.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109758 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/SemaObjC/conflict-nonfragile-abi2.m

index 6f971b116d61377794b2baae4717cc768481bee6..a934adfb0c4bd764abc7da6949143714e19b3227 100644 (file)
@@ -1170,7 +1170,8 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S,
 
   if (VarDecl *Var = R.getAsSingle<VarDecl>()) {
     if (getLangOptions().ObjCNonFragileABI && IvarLookupFollowUp &&
-        !getLangOptions().ObjCNonFragileABI2) {
+        !getLangOptions().ObjCNonFragileABI2 &&
+        Var->isFileVarDecl()) {
       ObjCPropertyDecl *Property = 
         OkToSynthesizeProvisionalIvar(*this, II, NameLoc);
       if (Property) {
index 49cff97ccbd104c991e9e53c2440604c34800795..14e666000c606586530457b0d5a0c9735cd8f5e5 100644 (file)
@@ -5,9 +5,30 @@ int glob;
 
 @interface I
 @property int glob; // expected-note {{property declared here}}
+@property int p;
+@property int le;
+@property int l;
+@property int ls;
+@property int r;
 @end
 
 @implementation I
 - (int) Meth { return glob; } // expected-warning {{'glob' lookup will access the property ivar in nonfragile-abi2 mode}}
 @synthesize glob;
+// rdar: // 8248681
+- (int) Meth1: (int) p {
+  extern int le;
+  int l = 1;
+  static int ls;
+  register int r;
+  p = le + ls + r;
+  return l;
+}
+@dynamic p;
+@dynamic le;
+@dynamic l;
+@dynamic ls;
+@dynamic r;
 @end
+
+