@@ -951,8 +951,7 @@ RetainSummaryManager::getMethodSummary(ObjCMessageExpr* ME,
951
951
if (!isNSType (ME->getReceiver ()->getType ()))
952
952
return 0 ;
953
953
954
- if (CStrInCStrNoCase (s, " create" ) || CStrInCStrNoCase (s, " copy" ) ||
955
- CStrInCStrNoCase (s, " new" )) {
954
+ if (followsFundamentalRule (s)) {
956
955
957
956
RetEffect E = isGCEnabled () ? RetEffect::MakeNoRet ()
958
957
: RetEffect::MakeOwned (true );
@@ -2226,13 +2225,14 @@ namespace {
2226
2225
}
2227
2226
else {
2228
2227
if (getTF ().isGCEnabled ())
2229
- return " leak of returned object (GC)" ;
2228
+ return " [naming convention] leak of returned object (GC)" ;
2230
2229
2231
2230
if (getTF ().getLangOptions ().getGCMode () == LangOptions::HybridGC)
2232
- return " leak of returned object (hybrid MM, non-GC)" ;
2231
+ return " [naming convention] leak of returned object (hybrid MM, "
2232
+ " non-GC)" ;
2233
2233
2234
2234
assert (getTF ().getLangOptions ().getGCMode () == LangOptions::NonGC);
2235
- return " leak of returned object" ;
2235
+ return " [naming convention] leak of returned object" ;
2236
2236
}
2237
2237
}
2238
2238
@@ -2617,12 +2617,13 @@ PathDiagnosticPiece* CFRefReport::getEndPath(BugReporter& br,
2617
2617
ObjCMethodDecl& MD = cast<ObjCMethodDecl>(BR.getGraph ().getCodeDecl ());
2618
2618
os << " is returned from a method whose name ('"
2619
2619
<< MD.getSelector ().getName ()
2620
- << " ') does not contain 'create', "
2621
- " 'copy', or 'new '. This violates the naming convention rules given"
2620
+ << " ') does not contain 'create' or 'copy' or otherwise starts with "
2621
+ " 'new' or 'alloc '. This violates the naming convention rules given"
2622
2622
" in the Memory Management Guide for Cocoa (object leaked)." ;
2623
2623
}
2624
2624
else
2625
- os << " is no longer referenced after this point and has a retain count of +"
2625
+ os << " is no longer referenced after this point and has a retain count of"
2626
+ " +"
2626
2627
<< RV->getCount () << " (object leaked)." ;
2627
2628
2628
2629
return new PathDiagnosticPiece (L, os.str (), Hint);
0 commit comments