Skip to content

Commit

Permalink
fix: Infinite loop when parsing libstdc++ with -stdc++23
Browse files Browse the repository at this point in the history
  • Loading branch information
royqh1979 committed Dec 21, 2024
1 parent b11495e commit 9a856bb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
33 changes: 17 additions & 16 deletions RedPandaIDE/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1497,23 +1497,24 @@ void Editor::showEvent(QShowEvent */*event*/)
{
if (mParser && !pMainWindow->isClosingAll()
&& !pMainWindow->isQuitting()) {
if (pSettings->codeCompletion().clearWhenEditorHidden()
&& pSettings->codeCompletion().shareParser()
&& !inProject()) {
if (isC_CPPHeaderFile(mFileType)
&& !mContextFile.isEmpty()
&& !mParser->isFileParsed(mContextFile))
resetCppParser(mParser);
else if (!mParser->isFileParsed(mFilename))
resetCppParser(mParser);
}
if (!mParser->isFileParsed(mFilename)) {
connect(mParser.get(),
&CppParser::onEndParsing,
this,
&Editor::onEndParsing);
if (!pMainWindow->openingFiles() && !pMainWindow->openingProject())
connect(mParser.get(),
&CppParser::onEndParsing,
this,
&Editor::onEndParsing);
if (!pMainWindow->openingFiles() && !pMainWindow->openingProject()) {
bool needReparse=((isC_CPPHeaderFile(mFileType)
&& !mContextFile.isEmpty()
&& !mParser->isFileParsed(mContextFile))
|| (!mParser->isFileParsed(mFilename)));
if (pSettings->codeCompletion().clearWhenEditorHidden()
&& pSettings->codeCompletion().shareParser()
&& !inProject()) {
if (needReparse)
resetCppParser(mParser);
}
if (needReparse) {
reparse(false);
}
}
}
if (inTab()) {
Expand Down
3 changes: 3 additions & 0 deletions RedPandaIDE/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4557,6 +4557,9 @@ void MainWindow::onEditorClosed()
return;
updateEditorActions();
updateAppTitle();
if (mEditorList->pageCount()==0) {

}
}

void MainWindow::onToolsOutputClear()
Expand Down
3 changes: 2 additions & 1 deletion RedPandaIDE/parser/cppparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5258,7 +5258,8 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName,
if (result->kind == EvalStatementKind::Type) {
doSkipInExpression(phraseExpression,pos,"{","}");
result->kind = EvalStatementKind::Variable;
}
} else
return PEvalStatement();
} else if (phraseExpression[pos] == "[") {
//Array subscripting
//skip to "]"
Expand Down

0 comments on commit 9a856bb

Please sign in to comment.