]> granicus.if.org Git - clang/commitdiff
Tweak the rule for deciding if a provisional ivar is needed
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 26 Jan 2011 00:57:01 +0000 (00:57 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 26 Jan 2011 00:57:01 +0000 (00:57 +0000)
in default ivar synthesis.  Fixes // rdar://8913053.

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

lib/Sema/SemaExpr.cpp
test/SemaObjC/synth-provisional-ivars-1.m [new file with mode: 0644]

index 9ebfb05933e580ef35cb12b74319671473584257..3112ccb55f398333f51b300bd8a37f4a9c955e26 100644 (file)
@@ -1354,7 +1354,8 @@ static ObjCIvarDecl *SynthesizeProvisionalIvar(Sema &SemaRef,
     LookForIvars = false;
   else
     LookForIvars = (Lookup.isSingleResult() &&
-                    Lookup.getFoundDecl()->isDefinedOutsideFunctionOrMethod());
+                    Lookup.getFoundDecl()->isDefinedOutsideFunctionOrMethod() &&
+                    (Lookup.getAsSingle<VarDecl>() != 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 (file)
index 0000000..33de173
--- /dev/null
@@ -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