MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / getAllocFuncInfo

Method getAllocFuncInfo

lib/library.cpp:1268–1276  ·  view source on GitHub ↗

get allocation info for function */

Source from the content-addressed store, hash-verified

1266
1267/** get allocation info for function */
1268const Library::AllocFunc* Library::getAllocFuncInfo(const Token *tok) const
1269{
1270 while (Token::simpleMatch(tok, "::"))
1271 tok = tok->astOperand2() ? tok->astOperand2() : tok->astOperand1();
1272 if (!tok)
1273 return nullptr;
1274 const std::string funcname = getFunctionName(tok);
1275 return isNotLibraryFunction(tok) && mData->mFunctions.find(funcname) != mData->mFunctions.end() ? nullptr : getAllocDealloc(mData->mAlloc, funcname);
1276}
1277
1278/** get deallocation info for function */
1279const Library::AllocFunc* Library::getDeallocFuncInfo(const Token *tok) const

Callers 15

checkReallocUsageMethod · 0.80
isMallocMethod · 0.80
checkScopeMethod · 0.80
checkScopeForVariableMethod · 0.80
checkInvalidFreeMethod · 0.80
getOutparamAllocationFunction · 0.80
checkScopeMethod · 0.80
changeAllocStatusMethod · 0.80

Calls 6

getAllocDeallocFunction · 0.85
astOperand2Method · 0.80
astOperand1Method · 0.80
simpleMatchFunction · 0.70
findMethod · 0.45
endMethod · 0.45

Tested by 2

memoryMethod · 0.64
memory3Method · 0.64