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

Method simplifySQL

lib/tokenize.cpp:3792–3817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3790}
3791
3792void Tokenizer::simplifySQL()
3793{
3794 for (Token *tok = list.front(); tok; tok = tok->next()) {
3795 if (!Token::simpleMatch(tok, "__CPPCHECK_EMBEDDED_SQL_EXEC__ SQL"))
3796 continue;
3797
3798 const Token *end = findSQLBlockEnd(tok);
3799 if (end == nullptr)
3800 syntaxError(nullptr);
3801
3802 const std::string instruction = tok->stringifyList(end);
3803 // delete all tokens until the embedded SQL block end
3804 Token::eraseTokens(tok, end);
3805
3806 // insert "asm ( "instruction" ) ;"
3807 tok->str("asm");
3808 // it can happen that 'end' is NULL when wrong code is inserted
3809 if (!tok->next())
3810 tok->insertToken(";");
3811 tok->insertToken(")");
3812 tok->insertToken("\"" + instruction + "\"");
3813 tok->insertToken("(");
3814 // jump to ';' and continue
3815 tok = tok->tokAt(3);
3816 }
3817}
3818
3819void Tokenizer::simplifyParenthesizedLibraryFunctions()
3820{

Callers

nothing calls this directly

Calls 7

frontMethod · 0.80
nextMethod · 0.80
stringifyListMethod · 0.80
insertTokenMethod · 0.80
simpleMatchFunction · 0.70
strMethod · 0.45
tokAtMethod · 0.45

Tested by

no test coverage detected