Index: clang/lib/Analysis/RetainSummaryManager.cpp =================================================================== --- clang/lib/Analysis/RetainSummaryManager.cpp +++ clang/lib/Analysis/RetainSummaryManager.cpp @@ -499,19 +499,19 @@ if (const RetainSummary *S = getSummaryForOSObject(FD, FName, RetTy)) return S; - if (TrackObjCAndCFObjects) - if (const RetainSummary *S = - getSummaryForObjCOrCFObject(FD, FName, RetTy, FT, AllowAnnotations)) - return S; - if (const auto *MD = dyn_cast(FD)) - if (!(TrackOSObjects && isOSObjectRelated(MD))) + if (!isOSObjectRelated(MD)) return getPersistentSummary(RetEffect::MakeNoRet(), ArgEffects(AF.getEmptyMap()), ArgEffect(DoNothing), ArgEffect(StopTracking), ArgEffect(DoNothing)); + if (TrackObjCAndCFObjects) + if (const RetainSummary *S = + getSummaryForObjCOrCFObject(FD, FName, RetTy, FT, AllowAnnotations)) + return S; + return getDefaultSummary(); } Index: clang/test/Analysis/retain-release.mm =================================================================== --- clang/test/Analysis/retain-release.mm +++ clang/test/Analysis/retain-release.mm @@ -485,3 +485,18 @@ foo.CFRetain(0); // no-warning } } + +struct S { + static CFArrayRef testGetNoTracking(); + CFArrayRef testGetNoTrackingMember(); +}; + +void test_cxx_static_method_escaping() { + CFArrayRef arr = S::testGetNoTracking(); + CFRelease(arr); +} + +void test_cxx_method_escaping(S *s) { + CFArrayRef arr = s->testGetNoTrackingMember(); + CFRelease(arr); +}