]> granicus.if.org Git - clang/commitdiff
Minor performance improvement to not do unnecessary work
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 25 Oct 2013 22:04:47 +0000 (22:04 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 25 Oct 2013 22:04:47 +0000 (22:04 +0000)
in my last patch. // rdar://14989999

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

lib/Sema/SemaExpr.cpp

index 2fca0cdc1d3ed67f68a6ca200f989e2a4525f213..158cf015028c5902e219cae41ade2b7bbf426e06 100644 (file)
@@ -2257,12 +2257,14 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S,
         return ExprError();
 
       MarkAnyDeclReferenced(Loc, IV, true);
-      // Mark this ivar 'referenced' in this method, if it is a backing ivar
-      // of a property and current method is one of its property accessor.
-      const ObjCPropertyDecl *PDecl;
-      const ObjCIvarDecl *BIV = GetIvarBackingPropertyAccessor(CurMethod, PDecl);
-      if (BIV && BIV == IV)
-        IV->setBackingIvarReferencedInAccessor(true);
+      if (!IV->getBackingIvarReferencedInAccessor()) {
+        // Mark this ivar 'referenced' in this method, if it is a backing ivar
+        // of a property and current method is one of its property accessor.
+        const ObjCPropertyDecl *PDecl;
+        const ObjCIvarDecl *BIV = GetIvarBackingPropertyAccessor(CurMethod, PDecl);
+        if (BIV && BIV == IV)
+          IV->setBackingIvarReferencedInAccessor(true);
+      }
       
       ObjCMethodFamily MF = CurMethod->getMethodFamily();
       if (MF != OMF_init && MF != OMF_dealloc && MF != OMF_finalize &&