Symbol database: increased constness. ticket: #2468
This commit is contained in:
parent
657c22d23b
commit
d341b42b0c
|
@ -68,11 +68,11 @@ void CheckClass::constructors()
|
||||||
|
|
||||||
createSymbolDatabase();
|
createSymbolDatabase();
|
||||||
|
|
||||||
std::list<SymbolDatabase::SpaceInfo *>::iterator i;
|
std::list<SymbolDatabase::SpaceInfo *>::const_iterator i;
|
||||||
|
|
||||||
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
||||||
{
|
{
|
||||||
SymbolDatabase::SpaceInfo *info = *i;
|
const SymbolDatabase::SpaceInfo *info = *i;
|
||||||
|
|
||||||
// only check classes and structures
|
// only check classes and structures
|
||||||
if (!info->isClassOrStruct())
|
if (!info->isClassOrStruct())
|
||||||
|
@ -569,11 +569,11 @@ void CheckClass::privateFunctions()
|
||||||
|
|
||||||
createSymbolDatabase();
|
createSymbolDatabase();
|
||||||
|
|
||||||
std::list<SymbolDatabase::SpaceInfo *>::iterator i;
|
std::list<SymbolDatabase::SpaceInfo *>::const_iterator i;
|
||||||
|
|
||||||
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
||||||
{
|
{
|
||||||
SymbolDatabase::SpaceInfo *info = *i;
|
const SymbolDatabase::SpaceInfo *info = *i;
|
||||||
|
|
||||||
// only check classes and structures
|
// only check classes and structures
|
||||||
if (!info->isClassOrStruct())
|
if (!info->isClassOrStruct())
|
||||||
|
@ -1270,11 +1270,11 @@ void CheckClass::checkConst()
|
||||||
|
|
||||||
createSymbolDatabase();
|
createSymbolDatabase();
|
||||||
|
|
||||||
std::list<SymbolDatabase::SpaceInfo *>::iterator it;
|
std::list<SymbolDatabase::SpaceInfo *>::const_iterator it;
|
||||||
|
|
||||||
for (it = symbolDatabase->spaceInfoList.begin(); it != symbolDatabase->spaceInfoList.end(); ++it)
|
for (it = symbolDatabase->spaceInfoList.begin(); it != symbolDatabase->spaceInfoList.end(); ++it)
|
||||||
{
|
{
|
||||||
SymbolDatabase::SpaceInfo *info = *it;
|
const SymbolDatabase::SpaceInfo *info = *it;
|
||||||
|
|
||||||
// only check classes and structures
|
// only check classes and structures
|
||||||
if (!info->isClassOrStruct())
|
if (!info->isClassOrStruct())
|
||||||
|
@ -1353,7 +1353,7 @@ void CheckClass::checkConst()
|
||||||
if (checkConstFunc(info, paramEnd))
|
if (checkConstFunc(info, paramEnd))
|
||||||
{
|
{
|
||||||
std::string classname = info->className;
|
std::string classname = info->className;
|
||||||
SymbolDatabase::SpaceInfo *nest = info->nestedIn;
|
const SymbolDatabase::SpaceInfo *nest = info->nestedIn;
|
||||||
while (nest && nest->type != SymbolDatabase::SpaceInfo::Global)
|
while (nest && nest->type != SymbolDatabase::SpaceInfo::Global)
|
||||||
{
|
{
|
||||||
classname = std::string(nest->className + "::" + classname);
|
classname = std::string(nest->className + "::" + classname);
|
||||||
|
|
|
@ -110,7 +110,7 @@ private:
|
||||||
*/
|
*/
|
||||||
void createSymbolDatabase();
|
void createSymbolDatabase();
|
||||||
|
|
||||||
SymbolDatabase *symbolDatabase;
|
const SymbolDatabase *symbolDatabase;
|
||||||
|
|
||||||
// Reporting errors..
|
// Reporting errors..
|
||||||
void noConstructorError(const Token *tok, const std::string &classname, bool isStruct);
|
void noConstructorError(const Token *tok, const std::string &classname, bool isStruct);
|
||||||
|
|
|
@ -569,7 +569,7 @@ void CheckMemoryLeakInFunction::parse_noreturn()
|
||||||
|
|
||||||
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
||||||
{
|
{
|
||||||
SymbolDatabase::SpaceInfo *info = *i;
|
const SymbolDatabase::SpaceInfo *info = *i;
|
||||||
|
|
||||||
// only check functions
|
// only check functions
|
||||||
if (info->type != SymbolDatabase::SpaceInfo::Function)
|
if (info->type != SymbolDatabase::SpaceInfo::Function)
|
||||||
|
@ -2495,7 +2495,7 @@ void CheckMemoryLeakInFunction::checkReallocUsage()
|
||||||
|
|
||||||
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
||||||
{
|
{
|
||||||
SymbolDatabase::SpaceInfo *info = *i;
|
const SymbolDatabase::SpaceInfo *info = *i;
|
||||||
|
|
||||||
// only check functions
|
// only check functions
|
||||||
if (info->type != SymbolDatabase::SpaceInfo::Function)
|
if (info->type != SymbolDatabase::SpaceInfo::Function)
|
||||||
|
@ -2648,7 +2648,7 @@ void CheckMemoryLeakInFunction::check()
|
||||||
|
|
||||||
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
||||||
{
|
{
|
||||||
SymbolDatabase::SpaceInfo *info = *i;
|
const SymbolDatabase::SpaceInfo *info = *i;
|
||||||
|
|
||||||
// only check functions
|
// only check functions
|
||||||
if (info->type != SymbolDatabase::SpaceInfo::Function)
|
if (info->type != SymbolDatabase::SpaceInfo::Function)
|
||||||
|
@ -2699,9 +2699,9 @@ void CheckMemoryLeakInFunction::check()
|
||||||
|
|
||||||
void CheckMemoryLeakInClass::check()
|
void CheckMemoryLeakInClass::check()
|
||||||
{
|
{
|
||||||
SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||||
|
|
||||||
std::list<SymbolDatabase::SpaceInfo *>::iterator i;
|
std::list<SymbolDatabase::SpaceInfo *>::const_iterator i;
|
||||||
|
|
||||||
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -3164,7 +3164,7 @@ void CheckMemoryLeakNoVar::check()
|
||||||
c.analyse(_tokenizer->tokens(), uvarFunctions);
|
c.analyse(_tokenizer->tokens(), uvarFunctions);
|
||||||
}
|
}
|
||||||
|
|
||||||
SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||||
|
|
||||||
std::list<SymbolDatabase::SpaceInfo *>::const_iterator i;
|
std::list<SymbolDatabase::SpaceInfo *>::const_iterator i;
|
||||||
|
|
||||||
|
|
|
@ -352,7 +352,7 @@ public:
|
||||||
/** Function names for functions that are not "noreturn" */
|
/** Function names for functions that are not "noreturn" */
|
||||||
std::set<std::string> notnoreturn;
|
std::set<std::string> notnoreturn;
|
||||||
|
|
||||||
SymbolDatabase *symbolDatabase;
|
const SymbolDatabase *symbolDatabase;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1234,13 +1234,13 @@ void CheckOther::functionVariableUsage()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Parse all executing scopes..
|
// Parse all executing scopes..
|
||||||
SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||||
|
|
||||||
std::list<SymbolDatabase::SpaceInfo *>::const_iterator i;
|
std::list<SymbolDatabase::SpaceInfo *>::const_iterator i;
|
||||||
|
|
||||||
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
||||||
{
|
{
|
||||||
SymbolDatabase::SpaceInfo *info = *i;
|
const SymbolDatabase::SpaceInfo *info = *i;
|
||||||
|
|
||||||
// only check functions
|
// only check functions
|
||||||
if (info->type != SymbolDatabase::SpaceInfo::Function)
|
if (info->type != SymbolDatabase::SpaceInfo::Function)
|
||||||
|
@ -1902,13 +1902,13 @@ void CheckOther::checkVariableScope()
|
||||||
if (!_settings->isEnabled("information"))
|
if (!_settings->isEnabled("information"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||||
|
|
||||||
std::list<SymbolDatabase::SpaceInfo *>::const_iterator i;
|
std::list<SymbolDatabase::SpaceInfo *>::const_iterator i;
|
||||||
|
|
||||||
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
||||||
{
|
{
|
||||||
SymbolDatabase::SpaceInfo *info = *i;
|
const SymbolDatabase::SpaceInfo *info = *i;
|
||||||
|
|
||||||
// only check functions
|
// only check functions
|
||||||
if (info->type != SymbolDatabase::SpaceInfo::Function)
|
if (info->type != SymbolDatabase::SpaceInfo::Function)
|
||||||
|
@ -2529,9 +2529,9 @@ void CheckOther::checkMisusedScopedObject()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||||
|
|
||||||
std::list<SymbolDatabase::SpaceInfo *>::iterator i;
|
std::list<SymbolDatabase::SpaceInfo *>::const_iterator i;
|
||||||
|
|
||||||
// list of classes / structs
|
// list of classes / structs
|
||||||
std::set<std::string> identifiers;
|
std::set<std::string> identifiers;
|
||||||
|
@ -2543,7 +2543,7 @@ void CheckOther::checkMisusedScopedObject()
|
||||||
|
|
||||||
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
|
||||||
{
|
{
|
||||||
SymbolDatabase::SpaceInfo *info = *i;
|
const SymbolDatabase::SpaceInfo *info = *i;
|
||||||
|
|
||||||
// only check functions
|
// only check functions
|
||||||
if (info->type != SymbolDatabase::SpaceInfo::Function)
|
if (info->type != SymbolDatabase::SpaceInfo::Function)
|
||||||
|
|
|
@ -7954,11 +7954,11 @@ const Token *Tokenizer::getFunctionTokenByName(const char funcname[]) const
|
||||||
if (_symbolDatabase == NULL)
|
if (_symbolDatabase == NULL)
|
||||||
getSymbolDatabase();
|
getSymbolDatabase();
|
||||||
|
|
||||||
std::list<SymbolDatabase::SpaceInfo *>::iterator i;
|
std::list<SymbolDatabase::SpaceInfo *>::const_iterator i;
|
||||||
|
|
||||||
for (i = _symbolDatabase->spaceInfoList.begin(); i != _symbolDatabase->spaceInfoList.end(); ++i)
|
for (i = _symbolDatabase->spaceInfoList.begin(); i != _symbolDatabase->spaceInfoList.end(); ++i)
|
||||||
{
|
{
|
||||||
SymbolDatabase::SpaceInfo *info = *i;
|
const SymbolDatabase::SpaceInfo *info = *i;
|
||||||
|
|
||||||
if (info->type == SymbolDatabase::SpaceInfo::Function)
|
if (info->type == SymbolDatabase::SpaceInfo::Function)
|
||||||
{
|
{
|
||||||
|
@ -9235,7 +9235,7 @@ void Tokenizer::simplifyQtSignalsSlots()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SymbolDatabase *Tokenizer::getSymbolDatabase() const
|
const SymbolDatabase *Tokenizer::getSymbolDatabase() const
|
||||||
{
|
{
|
||||||
if (!_symbolDatabase)
|
if (!_symbolDatabase)
|
||||||
_symbolDatabase = new SymbolDatabase(this, _settings, _errorLogger);
|
_symbolDatabase = new SymbolDatabase(this, _settings, _errorLogger);
|
||||||
|
|
|
@ -572,9 +572,9 @@ public:
|
||||||
_settings = settings;
|
_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
SymbolDatabase * getSymbolDatabase() const;
|
const SymbolDatabase *getSymbolDatabase() const;
|
||||||
|
|
||||||
Token * deleteInvalidTypedef(Token *typeDef);
|
Token *deleteInvalidTypedef(Token *typeDef);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Disable copy constructor, no implementation */
|
/** Disable copy constructor, no implementation */
|
||||||
|
|
Loading…
Reference in New Issue