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

Method simplifyPointerToStandardType

lib/tokenize.cpp:7188–7208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7186}
7187
7188void Tokenizer::simplifyPointerToStandardType()
7189{
7190 if (!isC())
7191 return;
7192
7193 for (Token *tok = list.front(); tok; tok = tok->next()) {
7194 if (!Token::Match(tok, "& %name% [ 0 ] !!["))
7195 continue;
7196
7197 if (!Token::Match(tok->previous(), "[,(=]"))
7198 continue;
7199
7200 // Remove '[ 0 ]' suffix
7201 Token::eraseTokens(tok->next(), tok->tokAt(5));
7202 // Remove '&' prefix
7203 tok = tok->previous();
7204 if (!tok)
7205 break;
7206 tok->deleteNext();
7207 }
7208}
7209
7210void Tokenizer::simplifyFunctionPointers()
7211{

Callers

nothing calls this directly

Calls 5

frontMethod · 0.80
nextMethod · 0.80
deleteNextMethod · 0.80
isCFunction · 0.70
tokAtMethod · 0.45

Tested by

no test coverage detected