[cfe-commits] r161349 - /cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp

Jordan Rose jordan_rose at apple.com
Mon Aug 6 14:28:02 PDT 2012


Author: jrose
Date: Mon Aug  6 16:28:02 2012
New Revision: 161349

URL: http://llvm.org/viewvc/llvm-project?rev=161349&view=rev
Log:
[analyzer] Ignore OS X 10.8's annotations for NSMakeCollectable.

The frameworks correctly use the 'cf_consumed' and 'ns_returns_retained'
attributes for NSMakeCollectable, but we can model the behavior under
garbage collection more precisely than that.

No functionality change.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp?rev=161349&r1=161348&r2=161349&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp Mon Aug  6 16:28:02 2012
@@ -981,6 +981,7 @@
 
   // No summary?  Generate one.
   const RetainSummary *S = 0;
+  bool AllowAnnotations = true;
 
   do {
     // We generate "stop" summaries for implicitly defined functions.
@@ -1018,6 +1019,9 @@
       S = (RetTy->isObjCIdType())
           ? getUnarySummary(FT, cfmakecollectable)
           : getPersistentStopSummary();
+      // The headers on OS X 10.8 use cf_consumed/ns_returns_retained,
+      // but we can fully model NSMakeCollectable ourselves.
+      AllowAnnotations = false;
     } else if (FName == "IOBSDNameMatching" ||
                FName == "IOServiceMatching" ||
                FName == "IOServiceNameMatching" ||
@@ -1178,7 +1182,8 @@
     S = getDefaultSummary();
 
   // Annotations override defaults.
-  updateSummaryFromAnnotations(S, FD);
+  if (AllowAnnotations)
+    updateSummaryFromAnnotations(S, FD);
 
   FuncSummaries[FD] = S;
   return S;





More information about the cfe-commits mailing list