Loops over all varIds should start at 1.
This commit is contained in:
parent
ccd80e3407
commit
03b1afc28c
|
@ -1421,7 +1421,7 @@ void CheckClass::virtualDestructor()
|
|||
// pointer variables of type 'Base *'
|
||||
std::set<unsigned int> basepointer;
|
||||
|
||||
for (std::size_t k = 0; k < symbolDatabase->getVariableListSize(); k++) {
|
||||
for (std::size_t k = 1; k < symbolDatabase->getVariableListSize(); k++) {
|
||||
const Variable* var = symbolDatabase->getVariableFromVarId(k);
|
||||
if (var && var->isPointer() && var->type() == derivedFrom)
|
||||
basepointer.insert(var->declarationId());
|
||||
|
|
|
@ -2207,7 +2207,7 @@ void CheckMemoryLeakInFunction::check()
|
|||
}
|
||||
|
||||
// Check variables..
|
||||
for (unsigned int i = 0; i < symbolDatabase->getVariableListSize(); i++) {
|
||||
for (unsigned int i = 1; i < symbolDatabase->getVariableListSize(); i++) {
|
||||
const Variable* var = symbolDatabase->getVariableFromVarId(i);
|
||||
if (!var || (!var->isLocal() && !var->isArgument()) || var->isStatic() || !var->scope())
|
||||
continue;
|
||||
|
@ -2449,7 +2449,7 @@ void CheckMemoryLeakInClass::publicAllocationError(const Token *tok, const std::
|
|||
void CheckMemoryLeakStructMember::check()
|
||||
{
|
||||
const SymbolDatabase* symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||
for (unsigned int i = 0; i < symbolDatabase->getVariableListSize(); i++) {
|
||||
for (unsigned int i = 1; i < symbolDatabase->getVariableListSize(); i++) {
|
||||
const Variable* var = symbolDatabase->getVariableFromVarId(i);
|
||||
if (!var || !var->isLocal() || var->isStatic())
|
||||
continue;
|
||||
|
|
|
@ -2522,7 +2522,7 @@ void CheckOther::checkRedundantCopy()
|
|||
|
||||
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||
|
||||
for (std::size_t i = 0; i < symbolDatabase->getVariableListSize(); i++) {
|
||||
for (std::size_t i = 1; i < symbolDatabase->getVariableListSize(); i++) {
|
||||
const Variable* var = symbolDatabase->getVariableFromVarId(i);
|
||||
|
||||
if (!var || var->isReference() || !var->isConst() || var->isPointer() || (!var->type() && !var->isStlType())) // bailout if var is of standard type, if it is a pointer or non-const
|
||||
|
|
Loading…
Reference in New Issue