parent
fd062e2f34
commit
17fddff91b
|
@ -384,11 +384,11 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file)
|
|||
QString objStr = escapeFilenameForMakefilePrerequisite(shortFileName);
|
||||
// if we have scanned it, use scanned info
|
||||
if (parser && parser->fileScanned(unit->fileName())) {
|
||||
QSet<QString> fileIncludes = parser->getIncludedFiles(unit->fileName());
|
||||
QSet<QString> includedFiles = parser->getIncludedFiles(unit->fileName());
|
||||
foreach(const PProjectUnit &unit2, projectUnits) {
|
||||
if (unit2==unit)
|
||||
continue;
|
||||
if (fileIncludes.contains(unit2->fileName())) {
|
||||
if (includedFiles.contains(unit2->fileName())) {
|
||||
if (mProject->options().usePrecompiledHeader &&
|
||||
unit2->fileName() == mProject->options().precompiledHeader)
|
||||
precompileStr = " $(PCH) ";
|
||||
|
|
|
@ -219,11 +219,11 @@ void SDCCProjectCompiler::writeMakeObjFilesRules(QFile &file)
|
|||
QString objStr = escapeFilenameForMakefilePrerequisite(shortFileName);
|
||||
// if we have scanned it, use scanned info
|
||||
if (parser && parser->fileScanned(unit->fileName())) {
|
||||
QSet<QString> fileIncludes = parser->getIncludedFiles(unit->fileName());
|
||||
QSet<QString> includedFiles = parser->getIncludedFiles(unit->fileName());
|
||||
foreach(const PProjectUnit &unit2, projectUnits) {
|
||||
if (unit2==unit)
|
||||
continue;
|
||||
if (fileIncludes.contains(unit2->fileName())) {
|
||||
if (includedFiles.contains(unit2->fileName())) {
|
||||
QString header = extractRelativePath(mProject->makeFileName(),unit2->fileName());
|
||||
objStr = objStr + ' ' + escapeFilenameForMakefilePrerequisite(header);
|
||||
}
|
||||
|
|
|
@ -1307,13 +1307,6 @@ bool Editor::onGetSpecialLineColors(int Line, QColor &foreground, QColor &backgr
|
|||
backgroundColor = mBreakpointBackgroundColor;
|
||||
return true;
|
||||
}
|
||||
// end else if Line = fErrorLine then begin
|
||||
// StrToThemeColor(tc, devEditor.Syntax.Values[cErr]);
|
||||
// BG := tc.Background;
|
||||
// FG := tc.Foreground;
|
||||
// if (BG <> clNone) or (FG<>clNone) then
|
||||
// Special := TRUE;
|
||||
// end;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2789,8 +2782,6 @@ bool Editor::handleParentheseCompletion()
|
|||
}
|
||||
return true;
|
||||
}
|
||||
// if (status == QuoteStatus::NotQuote) && FunctionTipAllowed then
|
||||
// fFunctionTip.Activated := true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4150,7 +4141,6 @@ QString Editor::getParserHint(const QStringList& expression,const QString &/*s*/
|
|||
} else { // hard defines
|
||||
result = mParser->prettyPrintStatement(statement, mFilename);
|
||||
}
|
||||
// Result := StringReplace(Result, '|', #5, [rfReplaceAll]);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -5940,10 +5940,6 @@ void MainWindow::onCompileIssue(PCompileIssue issue)
|
|||
return;
|
||||
ui->tableIssues->addIssue(issue);
|
||||
|
||||
// Update tab caption
|
||||
// if CompilerOutput.Items.Count = 1 then
|
||||
// CompSheet.Caption := Lang[ID_SHEET_COMP] + ' (' + IntToStr(CompilerOutput.Items.Count) + ')';
|
||||
|
||||
if (issue->type == CompileIssueType::Error || issue->type ==
|
||||
CompileIssueType::Warning) {
|
||||
Editor* e = mEditorList->getOpenedEditorByFilename(issue->filename);
|
||||
|
@ -7183,8 +7179,6 @@ void MainWindow::on_actionNew_Project_triggered()
|
|||
}
|
||||
}
|
||||
|
||||
// if cbDefault.Checked then
|
||||
// devData.DefCpp := rbCpp.Checked;
|
||||
QDir projectDir = QDir(location);
|
||||
if (!projectDir.isEmpty()) {
|
||||
if (QMessageBox::question(
|
||||
|
|
|
@ -200,20 +200,20 @@ PStatement CppParser::findScopeStatement(const QString &filename, int line)
|
|||
|
||||
PStatement CppParser::doFindScopeStatement(const QString &filename, int line) const
|
||||
{
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename);
|
||||
if (!fileIncludes)
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(filename);
|
||||
if (!fileInfo)
|
||||
return PStatement();
|
||||
|
||||
return fileIncludes->scopes.findScopeAtLine(line);
|
||||
return fileInfo->scopes.findScopeAtLine(line);
|
||||
}
|
||||
|
||||
PParsedFileInfo CppParser::findFileIncludes(const QString &filename, bool deleteIt)
|
||||
{
|
||||
QMutexLocker locker(&mMutex);
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename);
|
||||
if (deleteIt && fileIncludes)
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(filename);
|
||||
if (deleteIt && fileInfo)
|
||||
mPreprocessor.removeFileIncludes(filename);
|
||||
return fileIncludes;
|
||||
return fileInfo;
|
||||
}
|
||||
QString CppParser::findFirstTemplateParamOf(const QString &fileName, const QString &phrase, const PStatement& currentScope)
|
||||
{
|
||||
|
@ -234,10 +234,10 @@ QString CppParser::findTemplateParamOf(const QString &fileName, const QString &p
|
|||
PStatement CppParser::findFunctionAt(const QString &fileName, int line)
|
||||
{
|
||||
QMutexLocker locker(&mMutex);
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(fileName);
|
||||
if (!fileIncludes)
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(fileName);
|
||||
if (!fileInfo)
|
||||
return PStatement();
|
||||
for (PStatement& statement : fileIncludes->statements) {
|
||||
for (PStatement& statement : fileInfo->statements) {
|
||||
if (statement->kind != StatementKind::Function
|
||||
&& statement->kind != StatementKind::Constructor
|
||||
&& statement->kind != StatementKind::Destructor)
|
||||
|
@ -664,15 +664,15 @@ PStatement CppParser::doFindAliasedStatement(const PStatement &statement, QSet<S
|
|||
return PStatement();
|
||||
QString nsName=statement->type.mid(0,pos);
|
||||
QString name = statement->type.mid(pos+2);
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(statement->fileName);
|
||||
if (!fileIncludes)
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(statement->fileName);
|
||||
if (!fileInfo)
|
||||
return PStatement();
|
||||
foundSet.insert(statement.get());
|
||||
PStatement result;
|
||||
if (nsName.isEmpty()) {
|
||||
QList<PStatement> resultList = findMembersOfStatement(name,PStatement());
|
||||
foreach(const PStatement& resultStatement,resultList) {
|
||||
if (fileIncludes->includeFiles.contains(resultStatement->fileName)) {
|
||||
if (fileInfo->includeFiles.contains(resultStatement->fileName)) {
|
||||
result = resultStatement;
|
||||
break;
|
||||
}
|
||||
|
@ -685,7 +685,7 @@ PStatement CppParser::doFindAliasedStatement(const PStatement &statement, QSet<S
|
|||
QList<PStatement> resultList = findMembersOfStatement(name,namespaceStatement);
|
||||
|
||||
foreach(const PStatement& resultStatement,resultList) {
|
||||
if (fileIncludes->includeFiles.contains(resultStatement->fileName)) {
|
||||
if (fileInfo->includeFiles.contains(resultStatement->fileName)) {
|
||||
result = resultStatement;
|
||||
break;
|
||||
}
|
||||
|
@ -838,10 +838,10 @@ QStringList CppParser::getFileDirectIncludes(const QString &filename)
|
|||
return QStringList();
|
||||
if (filename.isEmpty())
|
||||
return QStringList();
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename);
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(filename);
|
||||
|
||||
if (fileIncludes) {
|
||||
return fileIncludes->directIncludes;
|
||||
if (fileInfo) {
|
||||
return fileInfo->directIncludes;
|
||||
}
|
||||
return QStringList();
|
||||
|
||||
|
@ -854,10 +854,10 @@ QSet<QString> CppParser::internalGetIncludedFiles(const QString &filename) const
|
|||
if (filename.isEmpty())
|
||||
return list;
|
||||
list.insert(filename);
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename);
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(filename);
|
||||
|
||||
if (fileIncludes) {
|
||||
foreach (const QString& file, fileIncludes->includeFiles.keys()) {
|
||||
if (fileInfo) {
|
||||
foreach (const QString& file, fileInfo->includeFiles.keys()) {
|
||||
list.insert(file);
|
||||
}
|
||||
}
|
||||
|
@ -883,13 +883,13 @@ QSet<QString> CppParser::internalGetFileUsings(const QString &filename) const
|
|||
return result;
|
||||
// if (mParsing)
|
||||
// return result;
|
||||
PParsedFileInfo fileIncludes= mPreprocessor.findFileIncludes(filename);
|
||||
if (fileIncludes) {
|
||||
foreach (const QString& usingName, fileIncludes->usings) {
|
||||
PParsedFileInfo fileInfo= mPreprocessor.findFileInfo(filename);
|
||||
if (fileInfo) {
|
||||
foreach (const QString& usingName, fileInfo->usings) {
|
||||
result.insert(usingName);
|
||||
}
|
||||
foreach (const QString& subFile,fileIncludes->includeFiles.keys()){
|
||||
PParsedFileInfo subIncludes = mPreprocessor.findFileIncludes(subFile);
|
||||
foreach (const QString& subFile,fileInfo->includeFiles.keys()){
|
||||
PParsedFileInfo subIncludes = mPreprocessor.findFileInfo(subFile);
|
||||
if (subIncludes) {
|
||||
foreach (const QString& usingName, subIncludes->usings) {
|
||||
result.insert(usingName);
|
||||
|
@ -939,10 +939,10 @@ bool CppParser::isLineVisible(const QString &fileName, int line)
|
|||
if (mParsing) {
|
||||
return true;
|
||||
}
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(fileName);
|
||||
if (!fileIncludes)
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(fileName);
|
||||
if (!fileInfo)
|
||||
return true;
|
||||
return fileIncludes->isLineVisible(line);
|
||||
return fileInfo->isLineVisible(line);
|
||||
}
|
||||
|
||||
void CppParser::invalidateFile(const QString &fileName)
|
||||
|
@ -1436,9 +1436,9 @@ PStatement CppParser::addStatement(const PStatement& parent,
|
|||
if (oldStatement && !oldStatement->hasDefinition()) {
|
||||
oldStatement->setHasDefinition(true);
|
||||
if (oldStatement->fileName!=fileName) {
|
||||
PParsedFileInfo fileIncludes=mPreprocessor.findFileIncludes(fileName);
|
||||
if (fileIncludes) {
|
||||
fileIncludes->statements.insert(oldStatement->fullName,
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(fileName);
|
||||
if (fileInfo) {
|
||||
fileInfo->statements.insert(oldStatement->fullName,
|
||||
oldStatement);
|
||||
}
|
||||
}
|
||||
|
@ -1497,9 +1497,9 @@ PStatement CppParser::addStatement(const PStatement& parent,
|
|||
}
|
||||
|
||||
if (result->kind!= StatementKind::Block) {
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(fileName);
|
||||
if (fileIncludes) {
|
||||
fileIncludes->statements.insert(result->fullName,result);
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(fileName);
|
||||
if (fileInfo) {
|
||||
fileInfo->statements.insert(result->fullName,result);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -1744,10 +1744,10 @@ void CppParser::addSoloScopeLevel(PStatement& statement, int line, bool shouldRe
|
|||
|
||||
mCurrentScope.append(statement);
|
||||
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(mCurrentFile);
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(mCurrentFile);
|
||||
|
||||
if (fileIncludes) {
|
||||
fileIncludes->scopes.addScope(line,statement);
|
||||
if (fileInfo) {
|
||||
fileInfo->scopes.addScope(line,statement);
|
||||
}
|
||||
|
||||
// Set new scope
|
||||
|
@ -1776,17 +1776,17 @@ void CppParser::removeScopeLevel(int line, int maxIndex)
|
|||
// qDebug()<<"--remove scope"<<mCurrentFile<<line<<mCurrentClassScope.count();
|
||||
#endif
|
||||
PStatement currentScope = getCurrentScope();
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(mCurrentFile);
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(mCurrentFile);
|
||||
if (currentScope) {
|
||||
if (currentScope->kind == StatementKind::Block) {
|
||||
if (currentScope->children.isEmpty()) {
|
||||
// remove no children block
|
||||
if (fileIncludes)
|
||||
fileIncludes->scopes.removeLastScope();
|
||||
if (fileInfo)
|
||||
fileInfo->scopes.removeLastScope();
|
||||
mStatementList.deleteStatement(currentScope);
|
||||
} else {
|
||||
if (fileIncludes)
|
||||
fileIncludes->statements.insert(currentScope->fullName,currentScope);
|
||||
if (fileInfo)
|
||||
fileInfo->statements.insert(currentScope->fullName,currentScope);
|
||||
}
|
||||
} else if (currentScope->kind == StatementKind::Class) {
|
||||
mIndex=indexOfNextSemicolon(mIndex, maxIndex);
|
||||
|
@ -1797,9 +1797,8 @@ void CppParser::removeScopeLevel(int line, int maxIndex)
|
|||
|
||||
// Set new scope
|
||||
currentScope = getCurrentScope();
|
||||
// fileIncludes:=FindFileIncludes(fCurrentFile);
|
||||
if (fileIncludes && fileIncludes->scopes.lastScope()!=currentScope) {
|
||||
fileIncludes->scopes.addScope(line,currentScope);
|
||||
if (fileInfo && fileInfo->scopes.lastScope()!=currentScope) {
|
||||
fileInfo->scopes.addScope(line,currentScope);
|
||||
}
|
||||
|
||||
if (!currentScope) {
|
||||
|
@ -1841,10 +1840,10 @@ QStringList CppParser::sortFilesByIncludeRelations(const QSet<QString> &files)
|
|||
while (!fileSet.isEmpty()) {
|
||||
bool found=false;
|
||||
foreach (const QString& file,fileSet) {
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(file);
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(file);
|
||||
bool hasInclude=false;
|
||||
if (fileIncludes) {
|
||||
foreach(const QString& inc,fileIncludes->includeFiles.keys()) {
|
||||
if (fileInfo) {
|
||||
foreach(const QString& inc,fileInfo->includeFiles.keys()) {
|
||||
if (fileSet.contains(inc)) {
|
||||
hasInclude=true;
|
||||
break;
|
||||
|
@ -3391,9 +3390,9 @@ void CppParser::handlePreprocessor()
|
|||
if (delimPos>=0) {
|
||||
// qDebug()<<mCurrentScope.size()<<mCurrentFile<<mTokenizer[mIndex]->line<<s.mid(0,delimPos).trimmed();
|
||||
mCurrentFile = s.mid(0,delimPos).trimmed();
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(mCurrentFile);
|
||||
if (fileIncludes) {
|
||||
mCurrentFile = fileIncludes->baseFile;
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(mCurrentFile);
|
||||
if (fileInfo) {
|
||||
mCurrentFile = fileInfo->baseFile;
|
||||
} else {
|
||||
mCurrentFile.squeeze();
|
||||
}
|
||||
|
@ -3974,7 +3973,7 @@ void CppParser::handleUsing(int maxIndex)
|
|||
scopeStatement->usingList.insert(fullName);
|
||||
}
|
||||
} else {
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileIncludes(mCurrentFile);
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(mCurrentFile);
|
||||
if (!fileInfo)
|
||||
return;
|
||||
if (mNamespaces.contains(usingName)) {
|
||||
|
@ -4281,9 +4280,9 @@ void CppParser::handleInheritance(PStatement derivedStatement, PClassInheritance
|
|||
inheritanceInfo->visibility);
|
||||
// inheritanceInfo->parentClassFilename = statement->fileName;
|
||||
inheritanceInfo->handled = true;
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(statement->fileName);
|
||||
Q_ASSERT(fileIncludes!=nullptr);
|
||||
fileIncludes->handledInheritances.append(inheritanceInfo);
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(statement->fileName);
|
||||
Q_ASSERT(fileInfo!=nullptr);
|
||||
fileInfo->handledInheritances.append(inheritanceInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4479,7 +4478,7 @@ PStatement CppParser::findMacro(const QString &phrase, const QString &fileName)
|
|||
if (statementMap.isEmpty())
|
||||
return PStatement();
|
||||
StatementList statements = statementMap.values(phrase);
|
||||
PParsedFileInfo includes = mPreprocessor.findFileIncludes(fileName);
|
||||
PParsedFileInfo includes = mPreprocessor.findFileInfo(fileName);
|
||||
foreach (const PStatement& s, statements) {
|
||||
if (s->kind == StatementKind::Preprocessor) {
|
||||
if (includes && fileName != s->fileName && !includes->includeFiles.contains(s->fileName))
|
||||
|
@ -4542,14 +4541,14 @@ PStatement CppParser::findMemberOfStatement(const QString& filename,
|
|||
return statementMap.value(s,PStatement());
|
||||
} else {
|
||||
QList<PStatement> stats = statementMap.values(s);
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename);
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(filename);
|
||||
foreach(const PStatement &s,stats) {
|
||||
if (s->line==-1) {
|
||||
return s; // hard defines
|
||||
} if (s->fileName == filename || s->definitionFileName==filename) {
|
||||
return s;
|
||||
} else if (fileIncludes && (fileIncludes->includeFiles.contains(s->fileName)
|
||||
|| fileIncludes->includeFiles.contains(s->definitionFileName))) {
|
||||
} else if (fileInfo && (fileInfo->includeFiles.contains(s->fileName)
|
||||
|| fileInfo->includeFiles.contains(s->definitionFileName))) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
@ -5963,8 +5962,8 @@ QSet<QString> CppParser::calculateFilesToBeReparsed(const QString &fileName)
|
|||
QSet<QString> result;
|
||||
result.insert(fileName);
|
||||
foreach (const QString& file, mProjectFiles) {
|
||||
PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(file);
|
||||
if (fileIncludes && fileIncludes->includeFiles.contains(fileName)) {
|
||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(file);
|
||||
if (fileInfo && fileInfo->includeFiles.contains(fileName)) {
|
||||
result.insert(file);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ void CppPreprocessor::clear()
|
|||
|
||||
//Result across processings.
|
||||
//used by parser even preprocess finished
|
||||
mIncludesList.clear();
|
||||
mFileInfos.clear();
|
||||
mFileDefines.clear(); //dictionary to save defines for each headerfile;
|
||||
mFileUndefines.clear(); //dictionary to save undefines for each headerfile;
|
||||
mScannedFiles.clear();
|
||||
|
@ -57,7 +57,7 @@ void CppPreprocessor::clearTempResults()
|
|||
mFileName="";
|
||||
mBuffer.clear();
|
||||
mResult.clear();
|
||||
mCurrentIncludes=nullptr;
|
||||
mCurrentFileInfo=nullptr;
|
||||
mIncludes.clear(); // stack of files we've stepped into. last one is current file, first one is source file
|
||||
mBranchResults.clear();// stack of branch results (boolean). last one is current branch, first one is outermost branch
|
||||
//mDefines.clear(); // working set, editable
|
||||
|
@ -224,8 +224,8 @@ void CppPreprocessor::dumpIncludesListTo(const QString &fileName) const
|
|||
QFile file(fileName);
|
||||
if (file.open(QIODevice::WriteOnly|QIODevice::Truncate)) {
|
||||
QTextStream stream(&file);
|
||||
for (const PParsedFileInfo& fileIncludes:mIncludesList) {
|
||||
stream<<fileIncludes->baseFile<<" : "
|
||||
for (const PParsedFileInfo& fileInfo:mFileInfos) {
|
||||
stream<<fileInfo->baseFile<<" : "
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||
<<Qt::endl;
|
||||
#else
|
||||
|
@ -237,7 +237,7 @@ void CppPreprocessor::dumpIncludesListTo(const QString &fileName) const
|
|||
#else
|
||||
<<endl;
|
||||
#endif
|
||||
foreach (const QString& s,fileIncludes->includeFiles.keys()) {
|
||||
foreach (const QString& s,fileInfo->includeFiles.keys()) {
|
||||
stream<<"\t--"+s
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||
<<Qt::endl;
|
||||
|
@ -245,49 +245,6 @@ void CppPreprocessor::dumpIncludesListTo(const QString &fileName) const
|
|||
<<endl;
|
||||
#endif
|
||||
}
|
||||
stream<<"\t**depends on:**"
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||
<<Qt::endl;
|
||||
#else
|
||||
<<endl;
|
||||
#endif
|
||||
stream<<"\t**depended by:**"
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||
<<Qt::endl;
|
||||
#else
|
||||
<<endl;
|
||||
#endif
|
||||
// stream<<"\t**using:**"
|
||||
// #if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||
// <<Qt::endl;
|
||||
// #else
|
||||
// <<endl;
|
||||
// #endif
|
||||
// foreach (const QString& s,fileIncludes->usings) {
|
||||
// stream<<"\t++"+s
|
||||
// #if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||
// <<Qt::endl;
|
||||
// #else
|
||||
// <<endl;
|
||||
// #endif
|
||||
// }
|
||||
// stream<<"\t**statements:**"
|
||||
// #if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||
// <<Qt::endl;
|
||||
// #else
|
||||
// <<endl;
|
||||
// #endif
|
||||
// foreach (const PStatement& statement,fileIncludes->statements) {
|
||||
// if (statement) {
|
||||
// stream<<QString("\t**%1 , %2")
|
||||
// .arg(statement->command,statement->fullName)
|
||||
// #if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||
// <<Qt::endl;
|
||||
// #else
|
||||
// <<endl;
|
||||
// #endif
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -324,7 +281,7 @@ void CppPreprocessor::removeScannedFile(const QString &filename)
|
|||
{
|
||||
invalidDefinesInFile(filename);
|
||||
mScannedFiles.remove(filename);
|
||||
mIncludesList.remove(filename);
|
||||
mFileInfos.remove(filename);
|
||||
mFileDefines.remove(filename);
|
||||
mFileUndefines.remove(filename);
|
||||
}
|
||||
|
@ -478,7 +435,7 @@ void CppPreprocessor::handleInclude(const QString &line, bool fromNext)
|
|||
if (fileName.isEmpty())
|
||||
return;
|
||||
|
||||
PParsedFileInfo oldCurrentIncludes = mCurrentIncludes;
|
||||
PParsedFileInfo oldCurrentIncludes = mCurrentFileInfo;
|
||||
openInclude(fileName);
|
||||
}
|
||||
|
||||
|
@ -803,9 +760,9 @@ void CppPreprocessor::removeGCCAttribute(const QString &line, QString &newLine,
|
|||
|
||||
void CppPreprocessor::openInclude(QString fileName)
|
||||
{
|
||||
PParsedFileInfo fileIncludes = getFileIncludesEntry(fileName);
|
||||
if (fileIncludes) {
|
||||
fileName = fileIncludes->baseFile;
|
||||
PParsedFileInfo fileInfo = findFileInfo(fileName);
|
||||
if (fileInfo) {
|
||||
fileName = fileInfo->baseFile;
|
||||
} else {
|
||||
fileName.squeeze();
|
||||
}
|
||||
|
@ -818,15 +775,15 @@ void CppPreprocessor::openInclude(QString fileName)
|
|||
// }
|
||||
bool alreadyIncluded = false;
|
||||
for (PParsedFile& parsedFile:mIncludes) {
|
||||
if (parsedFile->fileIncludes->includeFiles.contains(fileName)) {
|
||||
if (parsedFile->fileInfo->includeFiles.contains(fileName)) {
|
||||
alreadyIncluded = true;
|
||||
continue;
|
||||
}
|
||||
parsedFile->fileIncludes->includeFiles.insert(fileName,false);
|
||||
parsedFile->fileInfo->includeFiles.insert(fileName,false);
|
||||
}
|
||||
PParsedFile innerMostFile = mIncludes.back();
|
||||
innerMostFile->fileIncludes->includeFiles.insert(fileName,true);
|
||||
innerMostFile->fileIncludes->directIncludes.append(fileName);
|
||||
innerMostFile->fileInfo->includeFiles.insert(fileName,true);
|
||||
innerMostFile->fileInfo->directIncludes.append(fileName);
|
||||
if (alreadyIncluded)
|
||||
return;
|
||||
// Backup old position if we're entering a new file
|
||||
|
@ -844,14 +801,14 @@ void CppPreprocessor::openInclude(QString fileName)
|
|||
|
||||
// Keep track of files we include here
|
||||
// Only create new items for files we have NOT scanned yet
|
||||
mCurrentIncludes = getFileIncludesEntry(fileName);
|
||||
if (!mCurrentIncludes) {
|
||||
mCurrentFileInfo = findFileInfo(fileName);
|
||||
if (!mCurrentFileInfo) {
|
||||
// do NOT create a new item for a file that's already in the list
|
||||
mCurrentIncludes = std::make_shared<ParsedFileInfo>();
|
||||
mCurrentIncludes->baseFile = fileName;
|
||||
mIncludesList.insert(fileName,mCurrentIncludes);
|
||||
mCurrentFileInfo = std::make_shared<ParsedFileInfo>();
|
||||
mCurrentFileInfo->baseFile = fileName;
|
||||
mFileInfos.insert(fileName,mCurrentFileInfo);
|
||||
}
|
||||
parsedFile->fileIncludes = mCurrentIncludes;
|
||||
parsedFile->fileInfo = mCurrentFileInfo;
|
||||
|
||||
// Don't parse stuff we have already parsed
|
||||
if (!mScannedFiles.contains(fileName)) {
|
||||
|
@ -872,11 +829,11 @@ void CppPreprocessor::openInclude(QString fileName)
|
|||
} else {
|
||||
//add defines of already parsed including headers;
|
||||
addDefinesInFile(fileName);
|
||||
PParsedFileInfo fileIncludes = getFileIncludesEntry(fileName);
|
||||
if (fileIncludes) {
|
||||
PParsedFileInfo fileInfo = findFileInfo(fileName);
|
||||
if (fileInfo) {
|
||||
for (PParsedFile& file:mIncludes) {
|
||||
foreach (const QString& incFile,fileIncludes->includeFiles.keys()) {
|
||||
file->fileIncludes->includeFiles.insert(incFile,false);
|
||||
foreach (const QString& incFile,fileInfo->includeFiles.keys()) {
|
||||
file->fileInfo->includeFiles.insert(incFile,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -924,8 +881,7 @@ void CppPreprocessor::closeInclude()
|
|||
|
||||
|
||||
// Start augmenting previous include list again
|
||||
//fCurrentIncludes := GetFileIncludesEntry(fFileName);
|
||||
mCurrentIncludes = parsedFile->fileIncludes;
|
||||
mCurrentFileInfo = parsedFile->fileInfo;
|
||||
|
||||
// Update result file (we've left the previous file)
|
||||
mResult.append(
|
||||
|
@ -959,9 +915,9 @@ void CppPreprocessor::addDefinesInFile(const QString &fileName)
|
|||
}
|
||||
}
|
||||
|
||||
PParsedFileInfo fileIncludes = getFileIncludesEntry(fileName);
|
||||
if (fileIncludes) {
|
||||
foreach (const QString& file, fileIncludes->includeFiles.keys()) {
|
||||
PParsedFileInfo fileInfo = findFileInfo(fileName);
|
||||
if (fileInfo) {
|
||||
foreach (const QString& file, fileInfo->includeFiles.keys()) {
|
||||
addDefinesInFile(file);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ struct ParsedFile {
|
|||
QString fileName; // Record filename, but not used now
|
||||
QStringList buffer; // do not concat them all
|
||||
int branches; //branch levels;
|
||||
PParsedFileInfo fileIncludes; // includes of this file
|
||||
PParsedFileInfo fileInfo; // info of this file
|
||||
};
|
||||
using PParsedFile = std::shared_ptr<ParsedFile>;
|
||||
|
||||
|
@ -91,12 +91,12 @@ public:
|
|||
return mResult;
|
||||
};
|
||||
|
||||
PParsedFileInfo findFileIncludes(const QString& fileName) const {
|
||||
return mIncludesList.value(fileName);
|
||||
PParsedFileInfo findFileInfo(const QString& fileName) const {
|
||||
return mFileInfos.value(fileName);
|
||||
}
|
||||
|
||||
void removeFileIncludes(const QString& fileName) {
|
||||
mIncludesList.remove(fileName);
|
||||
mFileInfos.remove(fileName);
|
||||
}
|
||||
|
||||
bool fileScanned(const QString& fileName) const {
|
||||
|
@ -169,7 +169,7 @@ private:
|
|||
}
|
||||
void setCurrentBranch(BranchResult value){
|
||||
if (!sameResultWithCurrentBranch(value)) {
|
||||
mCurrentIncludes->branches.insert(mIndex+1,value==BranchResult::isTrue);
|
||||
mCurrentFileInfo->branches.insert(mIndex+1,value==BranchResult::isTrue);
|
||||
}
|
||||
mBranchResults.append(value);
|
||||
}
|
||||
|
@ -179,13 +179,9 @@ private:
|
|||
mBranchResults.pop_back();
|
||||
}
|
||||
if (!sameResultWithCurrentBranch(value)) {
|
||||
mCurrentIncludes->branches.insert(mIndex,getCurrentBranch()==BranchResult::isTrue);
|
||||
mCurrentFileInfo->branches.insert(mIndex,getCurrentBranch()==BranchResult::isTrue);
|
||||
}
|
||||
}
|
||||
// include stuff
|
||||
PParsedFileInfo getFileIncludesEntry(const QString& fileName){
|
||||
return mIncludesList.value(fileName,PParsedFileInfo());
|
||||
}
|
||||
void addDefinesInFile(const QString& fileName);
|
||||
void addDefineByParts(const QString& name, const QString& args,
|
||||
const QString& value, bool hardCoded);
|
||||
|
@ -262,7 +258,7 @@ private:
|
|||
QString mFileName;
|
||||
QStringList mBuffer;
|
||||
QStringList mResult;
|
||||
PParsedFileInfo mCurrentIncludes;
|
||||
PParsedFileInfo mCurrentFileInfo;
|
||||
int mPreProcIndex;
|
||||
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
|
||||
|
@ -272,7 +268,7 @@ private:
|
|||
|
||||
//Result across processings.
|
||||
//used by parser even preprocess finished
|
||||
QHash<QString,PParsedFileInfo> mIncludesList;
|
||||
QHash<QString, PParsedFileInfo> mFileInfos;
|
||||
QHash<QString, PDefineMap> mFileDefines; //dictionary to save defines for each headerfile;
|
||||
QHash<QString, PDefineMap> mFileUndefines; //dictionary to save defines for each headerfile;
|
||||
QSet<QString> mScannedFiles;
|
||||
|
|
|
@ -437,8 +437,6 @@ QString CppTokenizer::getPreprocessor()
|
|||
QString CppTokenizer::getWord()
|
||||
{
|
||||
bool bFoundTemplate = false;
|
||||
// bIsSmartPointer:=False;
|
||||
|
||||
// Skip spaces
|
||||
skipToNextToken();
|
||||
|
||||
|
|
|
@ -238,9 +238,6 @@ void resetCppParser(std::shared_ptr<CppParser> parser, int compilerSetIndex)
|
|||
return;
|
||||
// Configure parser
|
||||
parser->resetParser();
|
||||
//paser->enabled = pSettings-> devCodeCompletion.Enabled;
|
||||
// CppParser.ParseLocalHeaders := devCodeCompletion.ParseLocalHeaders;
|
||||
// CppParser.ParseGlobalHeaders := devCodeCompletion.ParseGlobalHeaders;
|
||||
parser->setEnabled(true);
|
||||
parser->setParseGlobalHeaders(true);
|
||||
parser->setParseLocalHeaders(true);
|
||||
|
|
|
@ -88,7 +88,6 @@ void CodeCompletionPopup::prepareSearch(
|
|||
QMutexLocker locker(&mMutex);
|
||||
if (!isEnabled())
|
||||
return;
|
||||
//Screen.Cursor := crHourglass;
|
||||
QCursor oldCursor = cursor();
|
||||
setCursor(Qt::CursorShape::WaitCursor);
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ QSynEdit::QSynEdit(QWidget *parent) : QAbstractScrollArea(parent),
|
|||
mFontDummy.setStyleStrategy(QFont::PreferAntialias);
|
||||
mDocument = std::make_shared<Document>(mFontDummy, this);
|
||||
|
||||
//fPlugins := TList.Create;
|
||||
mMouseMoved = false;
|
||||
mMouseOrigin = QPoint(0,0);
|
||||
mUndoing = false;
|
||||
|
@ -103,11 +102,7 @@ QSynEdit::QSynEdit(QWidget *parent) : QAbstractScrollArea(parent),
|
|||
mGutter.setRightOffset(21);
|
||||
mGutter.connect(&mGutter, &Gutter::changed, this, &QSynEdit::onGutterChanged);
|
||||
mGutterWidth = mGutter.realGutterWidth(charWidth());
|
||||
//ControlStyle := ControlStyle + [csOpaque, csSetCaption, csNeedsBorderPaint];
|
||||
//Height := 150;
|
||||
//Width := 200;
|
||||
this->setCursor(Qt::CursorShape::IBeamCursor);
|
||||
//TabStop := True;
|
||||
mInserting = true;
|
||||
mLineSpacingFactor = 1.0;
|
||||
|
||||
|
@ -121,9 +116,6 @@ QSynEdit::QSynEdit(QWidget *parent) : QAbstractScrollArea(parent),
|
|||
|
||||
//stop qt to auto fill background
|
||||
setAutoFillBackground(false);
|
||||
//fFocusList := TList.Create;
|
||||
//fKbdHandler := TSynEditKbdHandler.Create;
|
||||
//fMarkList.OnChange := MarkListChange;
|
||||
setDefaultKeystrokes();
|
||||
mRightEdgeColor = Qt::lightGray;
|
||||
|
||||
|
@ -1158,7 +1150,6 @@ void QSynEdit::processGutterClick(QMouseEvent *event)
|
|||
PCodeFoldingRange foldRange = foldStartAtLine(line);
|
||||
if (foldRange) {
|
||||
// See if we actually clicked on the rectangle...
|
||||
//rect.Left := Gutter.RealGutterWidth(CharWidth) - Gutter.RightOffset;
|
||||
QRect rect;
|
||||
rect.setLeft(mGutterWidth - mGutter.rightOffset());
|
||||
rect.setRight(rect.left() + mGutter.rightOffset() - 4);
|
||||
|
|
Loading…
Reference in New Issue