]> granicus.if.org Git - clang/commitdiff
Minor tweak: Recognize 'CGCF' prefix in addition to 'CF' and 'CG'.
authorTed Kremenek <kremenek@apple.com>
Thu, 5 Mar 2009 22:11:14 +0000 (22:11 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 5 Mar 2009 22:11:14 +0000 (22:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66208 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFRefCount.cpp

index 8c3d9bf366f38b8230285bbcb84de7782f491e40..6caea59f3e40cad731acea77c283e29db50cc1fa 100644 (file)
@@ -849,6 +849,10 @@ RetainSummary* RetainSummaryManager::getSummary(FunctionDecl* FD) {
     const FunctionType* FT = FD->getType()->getAsFunctionType();
     const char* FName = FD->getIdentifier()->getName();
     
+    // Strip away preceding '_'.  Doing this here will effect all the checks
+    // down below.
+    while (*FName == '_') ++FName;
+    
     // Inspect the result type.
     QualType RetTy = FT->getResultType();
     
@@ -910,7 +914,13 @@ RetainSummary* RetainSummaryManager::getSummary(FunctionDecl* FD) {
     // Check for release functions, the only kind of functions that we care
     // about that don't return a pointer type.
     if (FName[0] == 'C' && (FName[1] == 'F' || FName[1] == 'G')) {
-      if (isRelease(FD, FName+2))
+      // Test for 'CGCF'.
+      if (FName[1] == 'G' && FName[2] == 'C' && FName[3] == 'F')
+        FName += 4;
+      else
+        FName += 2;
+      
+      if (isRelease(FD, FName))
         S = getUnarySummary(FT, cfrelease);
       else {
         assert (ScratchArgs.empty());