parent
cfd8ddc6de
commit
2855a93f07
|
|
@ -59,6 +59,11 @@ static bool followsFundamentalRule(const char* s) {
|
||||||
CStrInCStrNoCase(s, "new") == s || CStrInCStrNoCase(s, "alloc") == s;
|
CStrInCStrNoCase(s, "new") == s || CStrInCStrNoCase(s, "alloc") == s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool followsReturnRule(const char* s) {
|
||||||
|
while (*s == '_') ++s;
|
||||||
|
return followsFundamentalRule(s) || CStrInCStrNoCase(s, "init") == s;
|
||||||
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Selector creation functions.
|
// Selector creation functions.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
@ -1878,7 +1883,7 @@ CFRefCount::HandleSymbolDeath(GRStateManager& VMgr,
|
||||||
if (V.isReturnedOwned() && V.getCount() == 0)
|
if (V.isReturnedOwned() && V.getCount() == 0)
|
||||||
if (const ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(CD)) {
|
if (const ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(CD)) {
|
||||||
std::string s = MD->getSelector().getName();
|
std::string s = MD->getSelector().getName();
|
||||||
if (!followsFundamentalRule(s.c_str())) {
|
if (!followsReturnRule(s.c_str())) {
|
||||||
hasLeak = true;
|
hasLeak = true;
|
||||||
state = state.set<RefBindings>(sid, V ^ RefVal::ErrorLeakReturned);
|
state = state.set<RefBindings>(sid, V ^ RefVal::ErrorLeakReturned);
|
||||||
return std::make_pair(state, true);
|
return std::make_pair(state, true);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue