stringLiteralWrite: only check in function scopes
This commit is contained in:
parent
96891dface
commit
075b07fb6c
|
@ -34,7 +34,11 @@ namespace {
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void CheckString::stringLiteralWrite()
|
void CheckString::stringLiteralWrite()
|
||||||
{
|
{
|
||||||
for (const Token* tok = _tokenizer->tokens(); tok; tok = tok->next()) {
|
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||||
|
const std::size_t functions = symbolDatabase->functionScopes.size();
|
||||||
|
for (std::size_t i = 0; i < functions; ++i) {
|
||||||
|
const Scope * scope = symbolDatabase->functionScopes[i];
|
||||||
|
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
|
||||||
if (!tok->variable() || !tok->variable()->isPointer())
|
if (!tok->variable() || !tok->variable()->isPointer())
|
||||||
continue;
|
continue;
|
||||||
const Token *str = tok->getValueTokenMinStrSize();
|
const Token *str = tok->getValueTokenMinStrSize();
|
||||||
|
@ -46,6 +50,7 @@ void CheckString::stringLiteralWrite()
|
||||||
stringLiteralWriteError(tok);
|
stringLiteralWriteError(tok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CheckString::stringLiteralWriteError(const Token *tok)
|
void CheckString::stringLiteralWriteError(const Token *tok)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue