Symbol database: increased constness. ticket: #2468

This commit is contained in:
Robert Reif 2011-01-16 18:13:54 +01:00 committed by Daniel Marjamäki
parent 657c22d23b
commit d341b42b0c
7 changed files with 27 additions and 27 deletions

View File

@ -68,11 +68,11 @@ void CheckClass::constructors()
createSymbolDatabase();
std::list<SymbolDatabase::SpaceInfo *>::iterator i;
std::list<SymbolDatabase::SpaceInfo *>::const_iterator 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
if (!info->isClassOrStruct())
@ -569,11 +569,11 @@ void CheckClass::privateFunctions()
createSymbolDatabase();
std::list<SymbolDatabase::SpaceInfo *>::iterator i;
std::list<SymbolDatabase::SpaceInfo *>::const_iterator 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
if (!info->isClassOrStruct())
@ -1270,11 +1270,11 @@ void CheckClass::checkConst()
createSymbolDatabase();
std::list<SymbolDatabase::SpaceInfo *>::iterator it;
std::list<SymbolDatabase::SpaceInfo *>::const_iterator 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
if (!info->isClassOrStruct())
@ -1353,7 +1353,7 @@ void CheckClass::checkConst()
if (checkConstFunc(info, paramEnd))
{
std::string classname = info->className;
SymbolDatabase::SpaceInfo *nest = info->nestedIn;
const SymbolDatabase::SpaceInfo *nest = info->nestedIn;
while (nest && nest->type != SymbolDatabase::SpaceInfo::Global)
{
classname = std::string(nest->className + "::" + classname);

View File

@ -110,7 +110,7 @@ private:
*/
void createSymbolDatabase();
SymbolDatabase *symbolDatabase;
const SymbolDatabase *symbolDatabase;
// Reporting errors..
void noConstructorError(const Token *tok, const std::string &classname, bool isStruct);

View File

@ -569,7 +569,7 @@ void CheckMemoryLeakInFunction::parse_noreturn()
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
{
SymbolDatabase::SpaceInfo *info = *i;
const SymbolDatabase::SpaceInfo *info = *i;
// only check functions
if (info->type != SymbolDatabase::SpaceInfo::Function)
@ -2495,7 +2495,7 @@ void CheckMemoryLeakInFunction::checkReallocUsage()
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
{
SymbolDatabase::SpaceInfo *info = *i;
const SymbolDatabase::SpaceInfo *info = *i;
// only check functions
if (info->type != SymbolDatabase::SpaceInfo::Function)
@ -2648,7 +2648,7 @@ void CheckMemoryLeakInFunction::check()
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
{
SymbolDatabase::SpaceInfo *info = *i;
const SymbolDatabase::SpaceInfo *info = *i;
// only check functions
if (info->type != SymbolDatabase::SpaceInfo::Function)
@ -2699,9 +2699,9 @@ void CheckMemoryLeakInFunction::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)
{
@ -3164,7 +3164,7 @@ void CheckMemoryLeakNoVar::check()
c.analyse(_tokenizer->tokens(), uvarFunctions);
}
SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
std::list<SymbolDatabase::SpaceInfo *>::const_iterator i;

View File

@ -352,7 +352,7 @@ public:
/** Function names for functions that are not "noreturn" */
std::set<std::string> notnoreturn;
SymbolDatabase *symbolDatabase;
const SymbolDatabase *symbolDatabase;
};

View File

@ -1234,13 +1234,13 @@ void CheckOther::functionVariableUsage()
return;
// Parse all executing scopes..
SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
std::list<SymbolDatabase::SpaceInfo *>::const_iterator i;
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
{
SymbolDatabase::SpaceInfo *info = *i;
const SymbolDatabase::SpaceInfo *info = *i;
// only check functions
if (info->type != SymbolDatabase::SpaceInfo::Function)
@ -1902,13 +1902,13 @@ void CheckOther::checkVariableScope()
if (!_settings->isEnabled("information"))
return;
SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
std::list<SymbolDatabase::SpaceInfo *>::const_iterator i;
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
{
SymbolDatabase::SpaceInfo *info = *i;
const SymbolDatabase::SpaceInfo *info = *i;
// only check functions
if (info->type != SymbolDatabase::SpaceInfo::Function)
@ -2529,9 +2529,9 @@ void CheckOther::checkMisusedScopedObject()
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
std::set<std::string> identifiers;
@ -2543,7 +2543,7 @@ void CheckOther::checkMisusedScopedObject()
for (i = symbolDatabase->spaceInfoList.begin(); i != symbolDatabase->spaceInfoList.end(); ++i)
{
SymbolDatabase::SpaceInfo *info = *i;
const SymbolDatabase::SpaceInfo *info = *i;
// only check functions
if (info->type != SymbolDatabase::SpaceInfo::Function)

View File

@ -7954,11 +7954,11 @@ const Token *Tokenizer::getFunctionTokenByName(const char funcname[]) const
if (_symbolDatabase == NULL)
getSymbolDatabase();
std::list<SymbolDatabase::SpaceInfo *>::iterator i;
std::list<SymbolDatabase::SpaceInfo *>::const_iterator 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)
{
@ -9235,7 +9235,7 @@ void Tokenizer::simplifyQtSignalsSlots()
}
}
SymbolDatabase *Tokenizer::getSymbolDatabase() const
const SymbolDatabase *Tokenizer::getSymbolDatabase() const
{
if (!_symbolDatabase)
_symbolDatabase = new SymbolDatabase(this, _settings, _errorLogger);

View File

@ -572,9 +572,9 @@ public:
_settings = settings;
}
SymbolDatabase * getSymbolDatabase() const;
const SymbolDatabase *getSymbolDatabase() const;
Token * deleteInvalidTypedef(Token *typeDef);
Token *deleteInvalidTypedef(Token *typeDef);
private:
/** Disable copy constructor, no implementation */