optimize
This commit is contained in:
parent
6cf04c1ca6
commit
43dbbf798a
|
@ -3454,6 +3454,12 @@ 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.includesList().value(mCurrentFile);
|
||||||
|
if (fileIncludes) {
|
||||||
|
mCurrentFile = fileIncludes->baseFile;
|
||||||
|
} else {
|
||||||
|
mCurrentFile.squeeze();
|
||||||
|
}
|
||||||
mIsSystemHeader = isSystemHeaderFile(mCurrentFile) || isProjectHeaderFile(mCurrentFile);
|
mIsSystemHeader = isSystemHeaderFile(mCurrentFile) || isProjectHeaderFile(mCurrentFile);
|
||||||
mIsProjectFile = mProjectFiles.contains(mCurrentFile);
|
mIsProjectFile = mProjectFiles.contains(mCurrentFile);
|
||||||
mIsHeader = isHFile(mCurrentFile);
|
mIsHeader = isHFile(mCurrentFile);
|
||||||
|
|
|
@ -778,8 +778,17 @@ void CppPreprocessor::removeGCCAttribute(const QString &line, QString &newLine,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppPreprocessor::openInclude(const QString &fileName)
|
void CppPreprocessor::openInclude(QString fileName)
|
||||||
{
|
{
|
||||||
|
fileName.squeeze();
|
||||||
|
|
||||||
|
PFileIncludes fileIncludes = getFileIncludesEntry(fileName);
|
||||||
|
if (fileIncludes) {
|
||||||
|
fileName = fileIncludes->baseFile;
|
||||||
|
} else {
|
||||||
|
fileName.squeeze();
|
||||||
|
}
|
||||||
|
|
||||||
if (mIncludes.size()>0) {
|
if (mIncludes.size()>0) {
|
||||||
PParsedFile topFile = mIncludes.front();
|
PParsedFile topFile = mIncludes.front();
|
||||||
if (topFile->fileIncludes->includeFiles.contains(fileName)) {
|
if (topFile->fileIncludes->includeFiles.contains(fileName)) {
|
||||||
|
@ -826,7 +835,6 @@ void CppPreprocessor::openInclude(const QString &fileName)
|
||||||
mCurrentIncludes->baseFile = fileName;
|
mCurrentIncludes->baseFile = fileName;
|
||||||
mIncludesList.insert(fileName,mCurrentIncludes);
|
mIncludesList.insert(fileName,mCurrentIncludes);
|
||||||
}
|
}
|
||||||
|
|
||||||
parsedFile->fileIncludes = mCurrentIncludes;
|
parsedFile->fileIncludes = mCurrentIncludes;
|
||||||
|
|
||||||
// Don't parse stuff we have already parsed
|
// Don't parse stuff we have already parsed
|
||||||
|
|
|
@ -134,7 +134,7 @@ private:
|
||||||
PParsedFile getInclude(int index) const {
|
PParsedFile getInclude(int index) const {
|
||||||
return mIncludes[index];
|
return mIncludes[index];
|
||||||
}
|
}
|
||||||
void openInclude(const QString& fileName);
|
void openInclude(QString fileName);
|
||||||
void closeInclude();
|
void closeInclude();
|
||||||
|
|
||||||
// branch stuff
|
// branch stuff
|
||||||
|
|
Loading…
Reference in New Issue