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

Method addSemicolonAfterUnknownMacro

lib/tokenize.cpp:6785–6800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6783//---------------------------------------------------------------------------
6784
6785void Tokenizer::addSemicolonAfterUnknownMacro()
6786{
6787 if (!isCPP())
6788 return;
6789 for (Token *tok = list.front(); tok; tok = tok->next()) {
6790 if (tok->str() != ")")
6791 continue;
6792 const Token *macro = tok->link() ? tok->link()->previous() : nullptr;
6793 if (!macro || !macro->isName())
6794 continue;
6795 if (Token::simpleMatch(tok, ") try") && !Token::Match(macro, "if|for|while"))
6796 tok->insertToken(";");
6797 else if (Token::simpleMatch(tok, ") using"))
6798 tok->insertToken(";");
6799 }
6800}
6801//---------------------------------------------------------------------------
6802
6803void Tokenizer::simplifyEmptyNamespaces()

Callers

nothing calls this directly

Calls 6

isCPPFunction · 0.85
frontMethod · 0.80
nextMethod · 0.80
insertTokenMethod · 0.80
simpleMatchFunction · 0.70
strMethod · 0.45

Tested by

no test coverage detected