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

Method combineStringAndCharLiterals

lib/tokenize.cpp:3700–3721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3698}
3699
3700void Tokenizer::combineStringAndCharLiterals()
3701{
3702 // Combine strings
3703 for (Token *tok = list.front(); tok; tok = tok->next()) {
3704 if (!isStringLiteral(tok->str()))
3705 continue;
3706
3707 tok->str(simplifyString(tok->str()));
3708
3709 while (Token::Match(tok->next(), "%str%") || Token::Match(tok->next(), "_T|_TEXT|TEXT ( %str% )")) {
3710 if (tok->next()->isName()) {
3711 if (!mSettings.platform.isWindows())
3712 break;
3713 tok->deleteNext(2);
3714 tok->next()->deleteNext();
3715 }
3716 // Two strings after each other, combine them
3717 tok->concatStr(simplifyString(tok->strAt(1)));
3718 tok->deleteNext();
3719 }
3720 }
3721}
3722
3723void Tokenizer::concatenateNegativeNumberAndAnyPositive()
3724{

Callers 1

testAstMethod · 0.80

Calls 6

frontMethod · 0.80
nextMethod · 0.80
deleteNextMethod · 0.80
isStringLiteralFunction · 0.70
strMethod · 0.45
concatStrMethod · 0.45

Tested by 1

testAstMethod · 0.64