refactor: PParsedFileInfo

This commit is contained in:
Roy Qu 2024-04-09 18:19:48 +08:00
parent 9ef6d1f3e6
commit 35dccca91e
3 changed files with 10 additions and 10 deletions

View File

@ -778,11 +778,11 @@ void CppPreprocessor::openInclude(QString fileName)
if (parsedFile->fileInfo->including(fileName)) {
alreadyIncluded = true;
}
parsedFile->fileInfo->include(fileName);
parsedFile->fileInfo->addInclude(fileName);
}
PParsedFile innerMostFile = mIncludes.back();
innerMostFile->fileInfo->include(fileName);
innerMostFile->fileInfo->directInclude(fileName);
innerMostFile->fileInfo->addInclude(fileName);
innerMostFile->fileInfo->addDirectInclude(fileName);
if (alreadyIncluded)
return;
// Backup old position if we're entering a new file
@ -831,7 +831,7 @@ void CppPreprocessor::openInclude(QString fileName)
if (fileInfo) {
for (PParsedFile& file:mIncludes) {
foreach (const QString& incFile,fileInfo->includes()) {
file->fileInfo->include(incFile);
file->fileInfo->addInclude(incFile);
}
}
}

View File

@ -790,7 +790,7 @@ bool ParsedFileInfo::isLineVisible(int line) const
return lastI<0?true:mBranches[lastI];
}
void ParsedFileInfo::include(const QString &fileName)
void ParsedFileInfo::addInclude(const QString &fileName)
{
int count = mIncludeCounts.value(fileName,0);
count++;
@ -798,7 +798,7 @@ void ParsedFileInfo::include(const QString &fileName)
mIncludes.insert(fileName);
}
void ParsedFileInfo::uninclude(const QString &fileName)
void ParsedFileInfo::removeInclude(const QString &fileName)
{
int count = mIncludeCounts.value(fileName,0);
count--;
@ -809,7 +809,7 @@ void ParsedFileInfo::uninclude(const QString &fileName)
mIncludeCounts.insert(fileName,count);
}
void ParsedFileInfo::directInclude(const QString &fileName)
void ParsedFileInfo::addDirectInclude(const QString &fileName)
{
mDirectIncludes.append(fileName);
}

View File

@ -324,9 +324,9 @@ public:
ParsedFileInfo& operator=(const ParsedFileInfo&)=delete;
void insertBranch(int level, bool branchTrue);
bool isLineVisible(int line) const;
void include(const QString &fileName);
void uninclude(const QString &fileName);
void directInclude(const QString &fileName);
void addInclude(const QString &fileName);
void removeInclude(const QString &fileName);
void addDirectInclude(const QString &fileName);
bool including(const QString &fileName) const;
PStatement findScopeAtLine(int line) const;
void addStatement(const PStatement &statement);