]> granicus.if.org Git - clang/commitdiff
[analyzer] Future-proofing r163012 (nameless functions and RetainCountChecker)
authorJordan Rose <jordan_rose@apple.com>
Sat, 1 Sep 2012 17:39:13 +0000 (17:39 +0000)
committerJordan Rose <jordan_rose@apple.com>
Sat, 1 Sep 2012 17:39:13 +0000 (17:39 +0000)
Any future exceptions need to go INSIDE the test that checks if the
IdentifierInfo is non-null!

No functionality change. Thanks for the review, Ted.

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

lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp

index 94e905cbf1229a0f4c1e3512160603bb73f2397d..176f618a2bda02a979219aac3c422bcf94e8671a 100644 (file)
@@ -947,12 +947,12 @@ void RetainSummaryManager::updateSummaryForCall(const RetainSummary *&S,
     // This can generally only happen if we know that the callback will only be
     // called when the return value is already being deallocated.
     if (const FunctionCall *FC = dyn_cast<FunctionCall>(&Call)) {
-      IdentifierInfo *Name = FC->getDecl()->getIdentifier();
-
-      // This callback frees the associated buffer.
-      if (Name)
+      if (IdentifierInfo *Name = FC->getDecl()->getIdentifier()) {
+        // When the CGBitmapContext is deallocated, the callback here will free
+        // the associated data buffer.
         if (Name->isStr("CGBitmapContextCreateWithData"))
           RE = S->getRetEffect();
+      }
     }
 
     S = getPersistentSummary(RE, RecEffect, DefEffect);