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

Function isNullablePointer

lib/checknullpointer.cpp:249–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247
248
249static bool isNullablePointer(const Token* tok)
250{
251 if (!tok)
252 return false;
253 if (Token::simpleMatch(tok, "new") && tok->varId() == 0)
254 return false;
255 if (astIsPointer(tok))
256 return true;
257 if (astIsSmartPointer(tok))
258 return true;
259 if (Token::simpleMatch(tok, "."))
260 return isNullablePointer(tok->astOperand2());
261 if (const Variable* var = tok->variable()) {
262 return (var->isPointer() || var->isSmartPointer());
263 }
264 return false;
265}
266
267void CheckNullPointerImpl::nullPointerByDeRefAndCheck()
268{

Callers 1

Calls 6

astIsPointerFunction · 0.85
astIsSmartPointerFunction · 0.85
astOperand2Method · 0.80
variableMethod · 0.80
isSmartPointerMethod · 0.80
simpleMatchFunction · 0.70

Tested by

no test coverage detected