refactor: PParsedFileInfo
This commit is contained in:
parent
9ef6d1f3e6
commit
35dccca91e
|
@ -778,11 +778,11 @@ void CppPreprocessor::openInclude(QString fileName)
|
||||||
if (parsedFile->fileInfo->including(fileName)) {
|
if (parsedFile->fileInfo->including(fileName)) {
|
||||||
alreadyIncluded = true;
|
alreadyIncluded = true;
|
||||||
}
|
}
|
||||||
parsedFile->fileInfo->include(fileName);
|
parsedFile->fileInfo->addInclude(fileName);
|
||||||
}
|
}
|
||||||
PParsedFile innerMostFile = mIncludes.back();
|
PParsedFile innerMostFile = mIncludes.back();
|
||||||
innerMostFile->fileInfo->include(fileName);
|
innerMostFile->fileInfo->addInclude(fileName);
|
||||||
innerMostFile->fileInfo->directInclude(fileName);
|
innerMostFile->fileInfo->addDirectInclude(fileName);
|
||||||
if (alreadyIncluded)
|
if (alreadyIncluded)
|
||||||
return;
|
return;
|
||||||
// Backup old position if we're entering a new file
|
// Backup old position if we're entering a new file
|
||||||
|
@ -831,7 +831,7 @@ void CppPreprocessor::openInclude(QString fileName)
|
||||||
if (fileInfo) {
|
if (fileInfo) {
|
||||||
for (PParsedFile& file:mIncludes) {
|
for (PParsedFile& file:mIncludes) {
|
||||||
foreach (const QString& incFile,fileInfo->includes()) {
|
foreach (const QString& incFile,fileInfo->includes()) {
|
||||||
file->fileInfo->include(incFile);
|
file->fileInfo->addInclude(incFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -790,7 +790,7 @@ bool ParsedFileInfo::isLineVisible(int line) const
|
||||||
return lastI<0?true:mBranches[lastI];
|
return lastI<0?true:mBranches[lastI];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParsedFileInfo::include(const QString &fileName)
|
void ParsedFileInfo::addInclude(const QString &fileName)
|
||||||
{
|
{
|
||||||
int count = mIncludeCounts.value(fileName,0);
|
int count = mIncludeCounts.value(fileName,0);
|
||||||
count++;
|
count++;
|
||||||
|
@ -798,7 +798,7 @@ void ParsedFileInfo::include(const QString &fileName)
|
||||||
mIncludes.insert(fileName);
|
mIncludes.insert(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParsedFileInfo::uninclude(const QString &fileName)
|
void ParsedFileInfo::removeInclude(const QString &fileName)
|
||||||
{
|
{
|
||||||
int count = mIncludeCounts.value(fileName,0);
|
int count = mIncludeCounts.value(fileName,0);
|
||||||
count--;
|
count--;
|
||||||
|
@ -809,7 +809,7 @@ void ParsedFileInfo::uninclude(const QString &fileName)
|
||||||
mIncludeCounts.insert(fileName,count);
|
mIncludeCounts.insert(fileName,count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParsedFileInfo::directInclude(const QString &fileName)
|
void ParsedFileInfo::addDirectInclude(const QString &fileName)
|
||||||
{
|
{
|
||||||
mDirectIncludes.append(fileName);
|
mDirectIncludes.append(fileName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,9 +324,9 @@ public:
|
||||||
ParsedFileInfo& operator=(const ParsedFileInfo&)=delete;
|
ParsedFileInfo& operator=(const ParsedFileInfo&)=delete;
|
||||||
void insertBranch(int level, bool branchTrue);
|
void insertBranch(int level, bool branchTrue);
|
||||||
bool isLineVisible(int line) const;
|
bool isLineVisible(int line) const;
|
||||||
void include(const QString &fileName);
|
void addInclude(const QString &fileName);
|
||||||
void uninclude(const QString &fileName);
|
void removeInclude(const QString &fileName);
|
||||||
void directInclude(const QString &fileName);
|
void addDirectInclude(const QString &fileName);
|
||||||
bool including(const QString &fileName) const;
|
bool including(const QString &fileName) const;
|
||||||
PStatement findScopeAtLine(int line) const;
|
PStatement findScopeAtLine(int line) const;
|
||||||
void addStatement(const PStatement &statement);
|
void addStatement(const PStatement &statement);
|
||||||
|
|
Loading…
Reference in New Issue