renamed _symbolDatabase to mSymbolDatabase
This commit is contained in:
parent
d08b6e02b7
commit
d81fe83ca6
|
@ -142,7 +142,7 @@ Tokenizer::Tokenizer() :
|
||||||
list(nullptr),
|
list(nullptr),
|
||||||
mSettings(nullptr),
|
mSettings(nullptr),
|
||||||
mErrorLogger(nullptr),
|
mErrorLogger(nullptr),
|
||||||
_symbolDatabase(nullptr),
|
mSymbolDatabase(nullptr),
|
||||||
_varId(0),
|
_varId(0),
|
||||||
_unnamedCount(0),
|
_unnamedCount(0),
|
||||||
_codeWithTemplates(false), //is there any templates?
|
_codeWithTemplates(false), //is there any templates?
|
||||||
|
@ -157,7 +157,7 @@ Tokenizer::Tokenizer(const Settings *settings, ErrorLogger *errorLogger) :
|
||||||
list(settings),
|
list(settings),
|
||||||
mSettings(settings),
|
mSettings(settings),
|
||||||
mErrorLogger(errorLogger),
|
mErrorLogger(errorLogger),
|
||||||
_symbolDatabase(nullptr),
|
mSymbolDatabase(nullptr),
|
||||||
_varId(0),
|
_varId(0),
|
||||||
_unnamedCount(0),
|
_unnamedCount(0),
|
||||||
_codeWithTemplates(false), //is there any templates?
|
_codeWithTemplates(false), //is there any templates?
|
||||||
|
@ -172,7 +172,7 @@ Tokenizer::Tokenizer(const Settings *settings, ErrorLogger *errorLogger) :
|
||||||
|
|
||||||
Tokenizer::~Tokenizer()
|
Tokenizer::~Tokenizer()
|
||||||
{
|
{
|
||||||
delete _symbolDatabase;
|
delete mSymbolDatabase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1747,7 +1747,7 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration)
|
||||||
createSymbolDatabase();
|
createSymbolDatabase();
|
||||||
|
|
||||||
// Use symbol database to identify rvalue references. Split && to & &. This is safe, since it doesn't delete any tokens (which might be referenced by symbol database)
|
// Use symbol database to identify rvalue references. Split && to & &. This is safe, since it doesn't delete any tokens (which might be referenced by symbol database)
|
||||||
for (const Variable* var : _symbolDatabase->variableList()) {
|
for (const Variable* var : mSymbolDatabase->variableList()) {
|
||||||
if (var && var->isRValueReference()) {
|
if (var && var->isRValueReference()) {
|
||||||
Token* endTok = const_cast<Token*>(var->typeEndToken());
|
Token* endTok = const_cast<Token*>(var->typeEndToken());
|
||||||
endTok->str("&");
|
endTok->str("&");
|
||||||
|
@ -1758,8 +1758,8 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_symbolDatabase->setValueTypeInTokenList();
|
mSymbolDatabase->setValueTypeInTokenList();
|
||||||
ValueFlow::setValues(&list, _symbolDatabase, mErrorLogger, mSettings);
|
ValueFlow::setValues(&list, mSymbolDatabase, mErrorLogger, mSettings);
|
||||||
|
|
||||||
printDebugOutput(1);
|
printDebugOutput(1);
|
||||||
|
|
||||||
|
@ -4023,9 +4023,9 @@ bool Tokenizer::simplifyTokenList2()
|
||||||
|
|
||||||
// Create symbol database and then remove const keywords
|
// Create symbol database and then remove const keywords
|
||||||
createSymbolDatabase();
|
createSymbolDatabase();
|
||||||
_symbolDatabase->setValueTypeInTokenList();
|
mSymbolDatabase->setValueTypeInTokenList();
|
||||||
|
|
||||||
ValueFlow::setValues(&list, _symbolDatabase, mErrorLogger, mSettings);
|
ValueFlow::setValues(&list, mSymbolDatabase, mErrorLogger, mSettings);
|
||||||
|
|
||||||
if (mSettings->terminated())
|
if (mSettings->terminated())
|
||||||
return false;
|
return false;
|
||||||
|
@ -4047,11 +4047,11 @@ void Tokenizer::printDebugOutput(unsigned int simplification) const
|
||||||
if (mSettings->xml)
|
if (mSettings->xml)
|
||||||
std::cout << "<debug>" << std::endl;
|
std::cout << "<debug>" << std::endl;
|
||||||
|
|
||||||
if (_symbolDatabase) {
|
if (mSymbolDatabase) {
|
||||||
if (mSettings->xml)
|
if (mSettings->xml)
|
||||||
_symbolDatabase->printXml(std::cout);
|
mSymbolDatabase->printXml(std::cout);
|
||||||
else if (mSettings->verbose) {
|
else if (mSettings->verbose) {
|
||||||
_symbolDatabase->printOut("Symbol database");
|
mSymbolDatabase->printOut("Symbol database");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4064,11 +4064,11 @@ void Tokenizer::printDebugOutput(unsigned int simplification) const
|
||||||
std::cout << "</debug>" << std::endl;
|
std::cout << "</debug>" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_symbolDatabase && simplification == 2U && mSettings->debugwarnings) {
|
if (mSymbolDatabase && simplification == 2U && mSettings->debugwarnings) {
|
||||||
printUnknownTypes();
|
printUnknownTypes();
|
||||||
|
|
||||||
// the typeStartToken() should come before typeEndToken()
|
// the typeStartToken() should come before typeEndToken()
|
||||||
for (const Variable *var : _symbolDatabase->variableList()) {
|
for (const Variable *var : mSymbolDatabase->variableList()) {
|
||||||
if (!var)
|
if (!var)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -4156,7 +4156,7 @@ void Tokenizer::dump(std::ostream &out) const
|
||||||
}
|
}
|
||||||
out << " </tokenlist>" << std::endl;
|
out << " </tokenlist>" << std::endl;
|
||||||
|
|
||||||
_symbolDatabase->printXml(out);
|
mSymbolDatabase->printXml(out);
|
||||||
if (list.front())
|
if (list.front())
|
||||||
list.front()->printValueFlow(true, out);
|
list.front()->printValueFlow(true, out);
|
||||||
}
|
}
|
||||||
|
@ -9701,15 +9701,15 @@ void Tokenizer::simplifyQtSignalsSlots()
|
||||||
|
|
||||||
void Tokenizer::createSymbolDatabase()
|
void Tokenizer::createSymbolDatabase()
|
||||||
{
|
{
|
||||||
if (!_symbolDatabase)
|
if (!mSymbolDatabase)
|
||||||
_symbolDatabase = new SymbolDatabase(this, mSettings, mErrorLogger);
|
mSymbolDatabase = new SymbolDatabase(this, mSettings, mErrorLogger);
|
||||||
_symbolDatabase->validate();
|
mSymbolDatabase->validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tokenizer::deleteSymbolDatabase()
|
void Tokenizer::deleteSymbolDatabase()
|
||||||
{
|
{
|
||||||
delete _symbolDatabase;
|
delete mSymbolDatabase;
|
||||||
_symbolDatabase = nullptr;
|
mSymbolDatabase = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool operatorEnd(const Token * tok)
|
static bool operatorEnd(const Token * tok)
|
||||||
|
@ -9932,13 +9932,13 @@ void Tokenizer::simplifyReturnStrncat()
|
||||||
|
|
||||||
void Tokenizer::printUnknownTypes() const
|
void Tokenizer::printUnknownTypes() const
|
||||||
{
|
{
|
||||||
if (!_symbolDatabase)
|
if (!mSymbolDatabase)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::multimap<std::string, const Token *> unknowns;
|
std::multimap<std::string, const Token *> unknowns;
|
||||||
|
|
||||||
for (unsigned int i = 1; i <= _varId; ++i) {
|
for (unsigned int i = 1; i <= _varId; ++i) {
|
||||||
const Variable *var = _symbolDatabase->getVariableFromVarId(i);
|
const Variable *var = mSymbolDatabase->getVariableFromVarId(i);
|
||||||
if (!var)
|
if (!var)
|
||||||
continue;
|
continue;
|
||||||
// is unknown type?
|
// is unknown type?
|
||||||
|
|
|
@ -774,7 +774,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
const SymbolDatabase *getSymbolDatabase() const {
|
const SymbolDatabase *getSymbolDatabase() const {
|
||||||
return _symbolDatabase;
|
return mSymbolDatabase;
|
||||||
}
|
}
|
||||||
void createSymbolDatabase();
|
void createSymbolDatabase();
|
||||||
void deleteSymbolDatabase();
|
void deleteSymbolDatabase();
|
||||||
|
@ -872,7 +872,7 @@ private:
|
||||||
ErrorLogger* const mErrorLogger;
|
ErrorLogger* const mErrorLogger;
|
||||||
|
|
||||||
/** Symbol database that all checks etc can use */
|
/** Symbol database that all checks etc can use */
|
||||||
SymbolDatabase *_symbolDatabase;
|
SymbolDatabase *mSymbolDatabase;
|
||||||
|
|
||||||
/** E.g. "A" for code where "#ifdef A" is true. This is used to
|
/** E.g. "A" for code where "#ifdef A" is true. This is used to
|
||||||
print additional information in error situations. */
|
print additional information in error situations. */
|
||||||
|
|
Loading…
Reference in New Issue