refactor: rename FileIncludes to ParsedFileInfo
This commit is contained in:
parent
6b6c19574d
commit
fd062e2f34
|
@ -200,17 +200,17 @@ PStatement CppParser::findScopeStatement(const QString &filename, int line)
|
||||||
|
|
||||||
PStatement CppParser::doFindScopeStatement(const QString &filename, int line) const
|
PStatement CppParser::doFindScopeStatement(const QString &filename, int line) const
|
||||||
{
|
{
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(filename);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename);
|
||||||
if (!fileIncludes)
|
if (!fileIncludes)
|
||||||
return PStatement();
|
return PStatement();
|
||||||
|
|
||||||
return fileIncludes->scopes.findScopeAtLine(line);
|
return fileIncludes->scopes.findScopeAtLine(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
PFileIncludes CppParser::findFileIncludes(const QString &filename, bool deleteIt)
|
PParsedFileInfo CppParser::findFileIncludes(const QString &filename, bool deleteIt)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(filename);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename);
|
||||||
if (deleteIt && fileIncludes)
|
if (deleteIt && fileIncludes)
|
||||||
mPreprocessor.removeFileIncludes(filename);
|
mPreprocessor.removeFileIncludes(filename);
|
||||||
return fileIncludes;
|
return fileIncludes;
|
||||||
|
@ -234,7 +234,7 @@ QString CppParser::findTemplateParamOf(const QString &fileName, const QString &p
|
||||||
PStatement CppParser::findFunctionAt(const QString &fileName, int line)
|
PStatement CppParser::findFunctionAt(const QString &fileName, int line)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(fileName);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(fileName);
|
||||||
if (!fileIncludes)
|
if (!fileIncludes)
|
||||||
return PStatement();
|
return PStatement();
|
||||||
for (PStatement& statement : fileIncludes->statements) {
|
for (PStatement& statement : fileIncludes->statements) {
|
||||||
|
@ -664,7 +664,7 @@ PStatement CppParser::doFindAliasedStatement(const PStatement &statement, QSet<S
|
||||||
return PStatement();
|
return PStatement();
|
||||||
QString nsName=statement->type.mid(0,pos);
|
QString nsName=statement->type.mid(0,pos);
|
||||||
QString name = statement->type.mid(pos+2);
|
QString name = statement->type.mid(pos+2);
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(statement->fileName);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(statement->fileName);
|
||||||
if (!fileIncludes)
|
if (!fileIncludes)
|
||||||
return PStatement();
|
return PStatement();
|
||||||
foundSet.insert(statement.get());
|
foundSet.insert(statement.get());
|
||||||
|
@ -838,7 +838,7 @@ QStringList CppParser::getFileDirectIncludes(const QString &filename)
|
||||||
return QStringList();
|
return QStringList();
|
||||||
if (filename.isEmpty())
|
if (filename.isEmpty())
|
||||||
return QStringList();
|
return QStringList();
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(filename);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename);
|
||||||
|
|
||||||
if (fileIncludes) {
|
if (fileIncludes) {
|
||||||
return fileIncludes->directIncludes;
|
return fileIncludes->directIncludes;
|
||||||
|
@ -854,7 +854,7 @@ QSet<QString> CppParser::internalGetIncludedFiles(const QString &filename) const
|
||||||
if (filename.isEmpty())
|
if (filename.isEmpty())
|
||||||
return list;
|
return list;
|
||||||
list.insert(filename);
|
list.insert(filename);
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(filename);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename);
|
||||||
|
|
||||||
if (fileIncludes) {
|
if (fileIncludes) {
|
||||||
foreach (const QString& file, fileIncludes->includeFiles.keys()) {
|
foreach (const QString& file, fileIncludes->includeFiles.keys()) {
|
||||||
|
@ -883,13 +883,13 @@ QSet<QString> CppParser::internalGetFileUsings(const QString &filename) const
|
||||||
return result;
|
return result;
|
||||||
// if (mParsing)
|
// if (mParsing)
|
||||||
// return result;
|
// return result;
|
||||||
PFileIncludes fileIncludes= mPreprocessor.findFileIncludes(filename);
|
PParsedFileInfo fileIncludes= mPreprocessor.findFileIncludes(filename);
|
||||||
if (fileIncludes) {
|
if (fileIncludes) {
|
||||||
foreach (const QString& usingName, fileIncludes->usings) {
|
foreach (const QString& usingName, fileIncludes->usings) {
|
||||||
result.insert(usingName);
|
result.insert(usingName);
|
||||||
}
|
}
|
||||||
foreach (const QString& subFile,fileIncludes->includeFiles.keys()){
|
foreach (const QString& subFile,fileIncludes->includeFiles.keys()){
|
||||||
PFileIncludes subIncludes = mPreprocessor.findFileIncludes(subFile);
|
PParsedFileInfo subIncludes = mPreprocessor.findFileIncludes(subFile);
|
||||||
if (subIncludes) {
|
if (subIncludes) {
|
||||||
foreach (const QString& usingName, subIncludes->usings) {
|
foreach (const QString& usingName, subIncludes->usings) {
|
||||||
result.insert(usingName);
|
result.insert(usingName);
|
||||||
|
@ -939,7 +939,7 @@ bool CppParser::isLineVisible(const QString &fileName, int line)
|
||||||
if (mParsing) {
|
if (mParsing) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(fileName);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(fileName);
|
||||||
if (!fileIncludes)
|
if (!fileIncludes)
|
||||||
return true;
|
return true;
|
||||||
return fileIncludes->isLineVisible(line);
|
return fileIncludes->isLineVisible(line);
|
||||||
|
@ -1436,7 +1436,7 @@ PStatement CppParser::addStatement(const PStatement& parent,
|
||||||
if (oldStatement && !oldStatement->hasDefinition()) {
|
if (oldStatement && !oldStatement->hasDefinition()) {
|
||||||
oldStatement->setHasDefinition(true);
|
oldStatement->setHasDefinition(true);
|
||||||
if (oldStatement->fileName!=fileName) {
|
if (oldStatement->fileName!=fileName) {
|
||||||
PFileIncludes fileIncludes=mPreprocessor.findFileIncludes(fileName);
|
PParsedFileInfo fileIncludes=mPreprocessor.findFileIncludes(fileName);
|
||||||
if (fileIncludes) {
|
if (fileIncludes) {
|
||||||
fileIncludes->statements.insert(oldStatement->fullName,
|
fileIncludes->statements.insert(oldStatement->fullName,
|
||||||
oldStatement);
|
oldStatement);
|
||||||
|
@ -1497,7 +1497,7 @@ PStatement CppParser::addStatement(const PStatement& parent,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result->kind!= StatementKind::Block) {
|
if (result->kind!= StatementKind::Block) {
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(fileName);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(fileName);
|
||||||
if (fileIncludes) {
|
if (fileIncludes) {
|
||||||
fileIncludes->statements.insert(result->fullName,result);
|
fileIncludes->statements.insert(result->fullName,result);
|
||||||
}
|
}
|
||||||
|
@ -1744,7 +1744,7 @@ void CppParser::addSoloScopeLevel(PStatement& statement, int line, bool shouldRe
|
||||||
|
|
||||||
mCurrentScope.append(statement);
|
mCurrentScope.append(statement);
|
||||||
|
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(mCurrentFile);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(mCurrentFile);
|
||||||
|
|
||||||
if (fileIncludes) {
|
if (fileIncludes) {
|
||||||
fileIncludes->scopes.addScope(line,statement);
|
fileIncludes->scopes.addScope(line,statement);
|
||||||
|
@ -1776,7 +1776,7 @@ void CppParser::removeScopeLevel(int line, int maxIndex)
|
||||||
// qDebug()<<"--remove scope"<<mCurrentFile<<line<<mCurrentClassScope.count();
|
// qDebug()<<"--remove scope"<<mCurrentFile<<line<<mCurrentClassScope.count();
|
||||||
#endif
|
#endif
|
||||||
PStatement currentScope = getCurrentScope();
|
PStatement currentScope = getCurrentScope();
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(mCurrentFile);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(mCurrentFile);
|
||||||
if (currentScope) {
|
if (currentScope) {
|
||||||
if (currentScope->kind == StatementKind::Block) {
|
if (currentScope->kind == StatementKind::Block) {
|
||||||
if (currentScope->children.isEmpty()) {
|
if (currentScope->children.isEmpty()) {
|
||||||
|
@ -1841,7 +1841,7 @@ QStringList CppParser::sortFilesByIncludeRelations(const QSet<QString> &files)
|
||||||
while (!fileSet.isEmpty()) {
|
while (!fileSet.isEmpty()) {
|
||||||
bool found=false;
|
bool found=false;
|
||||||
foreach (const QString& file,fileSet) {
|
foreach (const QString& file,fileSet) {
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(file);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(file);
|
||||||
bool hasInclude=false;
|
bool hasInclude=false;
|
||||||
if (fileIncludes) {
|
if (fileIncludes) {
|
||||||
foreach(const QString& inc,fileIncludes->includeFiles.keys()) {
|
foreach(const QString& inc,fileIncludes->includeFiles.keys()) {
|
||||||
|
@ -3391,7 +3391,7 @@ void CppParser::handlePreprocessor()
|
||||||
if (delimPos>=0) {
|
if (delimPos>=0) {
|
||||||
// qDebug()<<mCurrentScope.size()<<mCurrentFile<<mTokenizer[mIndex]->line<<s.mid(0,delimPos).trimmed();
|
// qDebug()<<mCurrentScope.size()<<mCurrentFile<<mTokenizer[mIndex]->line<<s.mid(0,delimPos).trimmed();
|
||||||
mCurrentFile = s.mid(0,delimPos).trimmed();
|
mCurrentFile = s.mid(0,delimPos).trimmed();
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(mCurrentFile);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(mCurrentFile);
|
||||||
if (fileIncludes) {
|
if (fileIncludes) {
|
||||||
mCurrentFile = fileIncludes->baseFile;
|
mCurrentFile = fileIncludes->baseFile;
|
||||||
} else {
|
} else {
|
||||||
|
@ -3974,7 +3974,7 @@ void CppParser::handleUsing(int maxIndex)
|
||||||
scopeStatement->usingList.insert(fullName);
|
scopeStatement->usingList.insert(fullName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PFileIncludes fileInfo = mPreprocessor.findFileIncludes(mCurrentFile);
|
PParsedFileInfo fileInfo = mPreprocessor.findFileIncludes(mCurrentFile);
|
||||||
if (!fileInfo)
|
if (!fileInfo)
|
||||||
return;
|
return;
|
||||||
if (mNamespaces.contains(usingName)) {
|
if (mNamespaces.contains(usingName)) {
|
||||||
|
@ -4281,7 +4281,7 @@ void CppParser::handleInheritance(PStatement derivedStatement, PClassInheritance
|
||||||
inheritanceInfo->visibility);
|
inheritanceInfo->visibility);
|
||||||
// inheritanceInfo->parentClassFilename = statement->fileName;
|
// inheritanceInfo->parentClassFilename = statement->fileName;
|
||||||
inheritanceInfo->handled = true;
|
inheritanceInfo->handled = true;
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(statement->fileName);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(statement->fileName);
|
||||||
Q_ASSERT(fileIncludes!=nullptr);
|
Q_ASSERT(fileIncludes!=nullptr);
|
||||||
fileIncludes->handledInheritances.append(inheritanceInfo);
|
fileIncludes->handledInheritances.append(inheritanceInfo);
|
||||||
}
|
}
|
||||||
|
@ -4479,7 +4479,7 @@ PStatement CppParser::findMacro(const QString &phrase, const QString &fileName)
|
||||||
if (statementMap.isEmpty())
|
if (statementMap.isEmpty())
|
||||||
return PStatement();
|
return PStatement();
|
||||||
StatementList statements = statementMap.values(phrase);
|
StatementList statements = statementMap.values(phrase);
|
||||||
PFileIncludes includes = mPreprocessor.findFileIncludes(fileName);
|
PParsedFileInfo includes = mPreprocessor.findFileIncludes(fileName);
|
||||||
foreach (const PStatement& s, statements) {
|
foreach (const PStatement& s, statements) {
|
||||||
if (s->kind == StatementKind::Preprocessor) {
|
if (s->kind == StatementKind::Preprocessor) {
|
||||||
if (includes && fileName != s->fileName && !includes->includeFiles.contains(s->fileName))
|
if (includes && fileName != s->fileName && !includes->includeFiles.contains(s->fileName))
|
||||||
|
@ -4542,7 +4542,7 @@ PStatement CppParser::findMemberOfStatement(const QString& filename,
|
||||||
return statementMap.value(s,PStatement());
|
return statementMap.value(s,PStatement());
|
||||||
} else {
|
} else {
|
||||||
QList<PStatement> stats = statementMap.values(s);
|
QList<PStatement> stats = statementMap.values(s);
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(filename);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename);
|
||||||
foreach(const PStatement &s,stats) {
|
foreach(const PStatement &s,stats) {
|
||||||
if (s->line==-1) {
|
if (s->line==-1) {
|
||||||
return s; // hard defines
|
return s; // hard defines
|
||||||
|
@ -5900,7 +5900,7 @@ void CppParser::internalInvalidateFile(const QString &fileName)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// remove its include files list
|
// remove its include files list
|
||||||
PFileIncludes p = findFileIncludes(fileName, true);
|
PParsedFileInfo p = findFileIncludes(fileName, true);
|
||||||
if (p) {
|
if (p) {
|
||||||
//fPreprocessor.InvalidDefinesInFile(FileName); //we don't need this, since we reset defines after each parse
|
//fPreprocessor.InvalidDefinesInFile(FileName); //we don't need this, since we reset defines after each parse
|
||||||
//p->includeFiles.clear();
|
//p->includeFiles.clear();
|
||||||
|
@ -5963,7 +5963,7 @@ QSet<QString> CppParser::calculateFilesToBeReparsed(const QString &fileName)
|
||||||
QSet<QString> result;
|
QSet<QString> result;
|
||||||
result.insert(fileName);
|
result.insert(fileName);
|
||||||
foreach (const QString& file, mProjectFiles) {
|
foreach (const QString& file, mProjectFiles) {
|
||||||
PFileIncludes fileIncludes = mPreprocessor.findFileIncludes(file);
|
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(file);
|
||||||
if (fileIncludes && fileIncludes->includeFiles.contains(fileName)) {
|
if (fileIncludes && fileIncludes->includeFiles.contains(fileName)) {
|
||||||
result.insert(file);
|
result.insert(file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
const QString& phrase,
|
const QString& phrase,
|
||||||
int line);
|
int line);
|
||||||
PStatement findScopeStatement(const QString& filename, int line);
|
PStatement findScopeStatement(const QString& filename, int line);
|
||||||
PFileIncludes findFileIncludes(const QString &filename, bool deleteIt = false);
|
PParsedFileInfo findFileIncludes(const QString &filename, bool deleteIt = false);
|
||||||
QString findFirstTemplateParamOf(const QString& fileName,
|
QString findFirstTemplateParamOf(const QString& fileName,
|
||||||
const QString& phrase,
|
const QString& phrase,
|
||||||
const PStatement& currentScope);
|
const PStatement& currentScope);
|
||||||
|
|
|
@ -224,7 +224,7 @@ void CppPreprocessor::dumpIncludesListTo(const QString &fileName) const
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
if (file.open(QIODevice::WriteOnly|QIODevice::Truncate)) {
|
if (file.open(QIODevice::WriteOnly|QIODevice::Truncate)) {
|
||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
for (const PFileIncludes& fileIncludes:mIncludesList) {
|
for (const PParsedFileInfo& fileIncludes:mIncludesList) {
|
||||||
stream<<fileIncludes->baseFile<<" : "
|
stream<<fileIncludes->baseFile<<" : "
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||||
<<Qt::endl;
|
<<Qt::endl;
|
||||||
|
@ -478,7 +478,7 @@ void CppPreprocessor::handleInclude(const QString &line, bool fromNext)
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PFileIncludes oldCurrentIncludes = mCurrentIncludes;
|
PParsedFileInfo oldCurrentIncludes = mCurrentIncludes;
|
||||||
openInclude(fileName);
|
openInclude(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -803,7 +803,7 @@ void CppPreprocessor::removeGCCAttribute(const QString &line, QString &newLine,
|
||||||
|
|
||||||
void CppPreprocessor::openInclude(QString fileName)
|
void CppPreprocessor::openInclude(QString fileName)
|
||||||
{
|
{
|
||||||
PFileIncludes fileIncludes = getFileIncludesEntry(fileName);
|
PParsedFileInfo fileIncludes = getFileIncludesEntry(fileName);
|
||||||
if (fileIncludes) {
|
if (fileIncludes) {
|
||||||
fileName = fileIncludes->baseFile;
|
fileName = fileIncludes->baseFile;
|
||||||
} else {
|
} else {
|
||||||
|
@ -847,7 +847,7 @@ void CppPreprocessor::openInclude(QString fileName)
|
||||||
mCurrentIncludes = getFileIncludesEntry(fileName);
|
mCurrentIncludes = getFileIncludesEntry(fileName);
|
||||||
if (!mCurrentIncludes) {
|
if (!mCurrentIncludes) {
|
||||||
// do NOT create a new item for a file that's already in the list
|
// do NOT create a new item for a file that's already in the list
|
||||||
mCurrentIncludes = std::make_shared<FileIncludes>();
|
mCurrentIncludes = std::make_shared<ParsedFileInfo>();
|
||||||
mCurrentIncludes->baseFile = fileName;
|
mCurrentIncludes->baseFile = fileName;
|
||||||
mIncludesList.insert(fileName,mCurrentIncludes);
|
mIncludesList.insert(fileName,mCurrentIncludes);
|
||||||
}
|
}
|
||||||
|
@ -872,7 +872,7 @@ void CppPreprocessor::openInclude(QString fileName)
|
||||||
} else {
|
} else {
|
||||||
//add defines of already parsed including headers;
|
//add defines of already parsed including headers;
|
||||||
addDefinesInFile(fileName);
|
addDefinesInFile(fileName);
|
||||||
PFileIncludes fileIncludes = getFileIncludesEntry(fileName);
|
PParsedFileInfo fileIncludes = getFileIncludesEntry(fileName);
|
||||||
if (fileIncludes) {
|
if (fileIncludes) {
|
||||||
for (PParsedFile& file:mIncludes) {
|
for (PParsedFile& file:mIncludes) {
|
||||||
foreach (const QString& incFile,fileIncludes->includeFiles.keys()) {
|
foreach (const QString& incFile,fileIncludes->includeFiles.keys()) {
|
||||||
|
@ -959,7 +959,7 @@ void CppPreprocessor::addDefinesInFile(const QString &fileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PFileIncludes fileIncludes = getFileIncludesEntry(fileName);
|
PParsedFileInfo fileIncludes = getFileIncludesEntry(fileName);
|
||||||
if (fileIncludes) {
|
if (fileIncludes) {
|
||||||
foreach (const QString& file, fileIncludes->includeFiles.keys()) {
|
foreach (const QString& file, fileIncludes->includeFiles.keys()) {
|
||||||
addDefinesInFile(file);
|
addDefinesInFile(file);
|
||||||
|
|
|
@ -41,7 +41,7 @@ struct ParsedFile {
|
||||||
QString fileName; // Record filename, but not used now
|
QString fileName; // Record filename, but not used now
|
||||||
QStringList buffer; // do not concat them all
|
QStringList buffer; // do not concat them all
|
||||||
int branches; //branch levels;
|
int branches; //branch levels;
|
||||||
PFileIncludes fileIncludes; // includes of this file
|
PParsedFileInfo fileIncludes; // includes of this file
|
||||||
};
|
};
|
||||||
using PParsedFile = std::shared_ptr<ParsedFile>;
|
using PParsedFile = std::shared_ptr<ParsedFile>;
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public:
|
||||||
return mResult;
|
return mResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
PFileIncludes findFileIncludes(const QString& fileName) const {
|
PParsedFileInfo findFileIncludes(const QString& fileName) const {
|
||||||
return mIncludesList.value(fileName);
|
return mIncludesList.value(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,8 +183,8 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// include stuff
|
// include stuff
|
||||||
PFileIncludes getFileIncludesEntry(const QString& fileName){
|
PParsedFileInfo getFileIncludesEntry(const QString& fileName){
|
||||||
return mIncludesList.value(fileName,PFileIncludes());
|
return mIncludesList.value(fileName,PParsedFileInfo());
|
||||||
}
|
}
|
||||||
void addDefinesInFile(const QString& fileName);
|
void addDefinesInFile(const QString& fileName);
|
||||||
void addDefineByParts(const QString& name, const QString& args,
|
void addDefineByParts(const QString& name, const QString& args,
|
||||||
|
@ -262,7 +262,7 @@ private:
|
||||||
QString mFileName;
|
QString mFileName;
|
||||||
QStringList mBuffer;
|
QStringList mBuffer;
|
||||||
QStringList mResult;
|
QStringList mResult;
|
||||||
PFileIncludes mCurrentIncludes;
|
PParsedFileInfo mCurrentIncludes;
|
||||||
int mPreProcIndex;
|
int mPreProcIndex;
|
||||||
QList<PParsedFile> mIncludes; // stack of files we've stepped into. last one is current file, first one is source file
|
QList<PParsedFile> mIncludes; // stack of files we've stepped into. last one is current file, first one is source file
|
||||||
QList<BranchResult> mBranchResults;// stack of branch results (boolean). last one is current branch, first one is outermost branch
|
QList<BranchResult> mBranchResults;// stack of branch results (boolean). last one is current branch, first one is outermost branch
|
||||||
|
@ -272,7 +272,7 @@ private:
|
||||||
|
|
||||||
//Result across processings.
|
//Result across processings.
|
||||||
//used by parser even preprocess finished
|
//used by parser even preprocess finished
|
||||||
QHash<QString,PFileIncludes> mIncludesList;
|
QHash<QString,PParsedFileInfo> mIncludesList;
|
||||||
QHash<QString, PDefineMap> mFileDefines; //dictionary to save defines for each headerfile;
|
QHash<QString, PDefineMap> mFileDefines; //dictionary to save defines for each headerfile;
|
||||||
QHash<QString, PDefineMap> mFileUndefines; //dictionary to save defines for each headerfile;
|
QHash<QString, PDefineMap> mFileUndefines; //dictionary to save defines for each headerfile;
|
||||||
QSet<QString> mScannedFiles;
|
QSet<QString> mScannedFiles;
|
||||||
|
|
|
@ -767,7 +767,7 @@ bool isTypeKind(StatementKind kind)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileIncludes::isLineVisible(int line)
|
bool ParsedFileInfo::isLineVisible(int line)
|
||||||
{
|
{
|
||||||
int lastI=-1;
|
int lastI=-1;
|
||||||
foreach(int i,branches.keys()) {
|
foreach(int i,branches.keys()) {
|
||||||
|
|
|
@ -317,7 +317,7 @@ struct ClassInheritanceInfo {
|
||||||
|
|
||||||
using PClassInheritanceInfo = std::shared_ptr<ClassInheritanceInfo>;
|
using PClassInheritanceInfo = std::shared_ptr<ClassInheritanceInfo>;
|
||||||
|
|
||||||
struct FileIncludes {
|
struct ParsedFileInfo {
|
||||||
QString baseFile;
|
QString baseFile;
|
||||||
QMap<QString, bool> includeFiles; // true means the file is directly included, false means included indirectly
|
QMap<QString, bool> includeFiles; // true means the file is directly included, false means included indirectly
|
||||||
QStringList directIncludes; //
|
QStringList directIncludes; //
|
||||||
|
@ -329,7 +329,7 @@ struct FileIncludes {
|
||||||
QList<std::weak_ptr<ClassInheritanceInfo>> handledInheritances;
|
QList<std::weak_ptr<ClassInheritanceInfo>> handledInheritances;
|
||||||
bool isLineVisible(int line);
|
bool isLineVisible(int line);
|
||||||
};
|
};
|
||||||
using PFileIncludes = std::shared_ptr<FileIncludes>;
|
using PParsedFileInfo = std::shared_ptr<ParsedFileInfo>;
|
||||||
|
|
||||||
extern QStringList CppDirectives;
|
extern QStringList CppDirectives;
|
||||||
extern QStringList JavadocTags;
|
extern QStringList JavadocTags;
|
||||||
|
|
|
@ -283,7 +283,7 @@ void ClassBrowserModel::addMembers()
|
||||||
if (mCurrentFile.isEmpty())
|
if (mCurrentFile.isEmpty())
|
||||||
return;
|
return;
|
||||||
// show statements in the file
|
// show statements in the file
|
||||||
PFileIncludes p = mParser->findFileIncludes(mCurrentFile);
|
PParsedFileInfo p = mParser->findFileIncludes(mCurrentFile);
|
||||||
if (!p)
|
if (!p)
|
||||||
return;
|
return;
|
||||||
filterChildren(mRoot,p->statements);
|
filterChildren(mRoot,p->statements);
|
||||||
|
@ -291,7 +291,7 @@ void ClassBrowserModel::addMembers()
|
||||||
if (mParser->projectFiles().isEmpty())
|
if (mParser->projectFiles().isEmpty())
|
||||||
return;
|
return;
|
||||||
foreach(const QString& file,mParser->projectFiles()) {
|
foreach(const QString& file,mParser->projectFiles()) {
|
||||||
PFileIncludes p = mParser->findFileIncludes(file);
|
PParsedFileInfo p = mParser->findFileIncludes(file);
|
||||||
if (!p)
|
if (!p)
|
||||||
return;
|
return;
|
||||||
filterChildren(mRoot,p->statements);
|
filterChildren(mRoot,p->statements);
|
||||||
|
|
Loading…
Reference in New Issue