- fix: syntax issues' filepath info not correct when build projects

This commit is contained in:
royqh1979 2021-10-25 09:31:58 +08:00
parent 59ea699fb7
commit 3a7065e9d8
6 changed files with 24 additions and 7 deletions

View File

@ -10,6 +10,7 @@ Version 0.7.3
- enhancement: when running a program, redirect a data file to its stdin
- fix: can't correctly handle '&&' and '||' in the #if directive (and correctly parse windows.h header file)
- fix: crash when create an empty project
- fix: syntax issues' filepath info not correct when build projects
Version 0.7.2
- fix: rainbow parenthesis stop functioning when change editor's general options

View File

@ -295,6 +295,8 @@ QString Compiler::getCCompileArguments(bool checkSyntax)
value = pOption->value;
}
if (value > 0 && pOption->isC) {
if (checkSyntax && pOption->isLinker)
continue;
if (pOption->choices.isEmpty()) {
result += " " + pOption->setting;
} else if (value < pOption->choices.size()) {
@ -342,6 +344,8 @@ QString Compiler::getCppCompileArguments(bool checkSyntax)
value = pOption->value;
}
if (value > 0 && pOption->isCpp) {
if (checkSyntax && pOption->isLinker)
continue;
if (pOption->choices.isEmpty()) {
result += " " + pOption->setting;
} else if (value < pOption->choices.size()) {

View File

@ -59,7 +59,8 @@ bool FileCompiler::prepareForCompile()
throw CompileError(tr("Can't find the compiler for file %1").arg(mFilename));
}
mArguments += getLibraryArguments(fileType);
if (!mOnlyCheckSyntax)
mArguments += getLibraryArguments(fileType);
if (!fileExists(mCompiler)) {
throw CompileError(tr("The Compiler '%1' doesn't exists!").arg(mCompiler));

View File

@ -47,7 +47,8 @@ bool StdinCompiler::prepareForCompile()
default:
throw CompileError(tr("Can't find the compiler for file %1").arg(mFilename));
}
mArguments += getLibraryArguments(fileType);
if (!mOnlyCheckSyntax)
mArguments += getLibraryArguments(fileType);
if (!fileExists(mCompiler)) {
throw CompileError(tr("The Compiler '%1' doesn't exists!").arg(mCompiler));

View File

@ -991,7 +991,7 @@ void MainWindow::checkSyntaxInBack(Editor *e)
return;
mCheckSyntaxInBack=true;
ui->tableIssues->clearIssues();
clearIssues();
CompileTarget target =getCompileTarget();
if (target ==CompileTarget::Project) {
mCompilerManager->checkSyntax(e->filename(),e->text(),
@ -1024,7 +1024,7 @@ bool MainWindow::compile(bool rebuild)
if (e->inProject() && e->modified())
return false;
}
ui->tableIssues->clearIssues();
clearIssues();
// Increment build number automagically
if (mProject->options().versionInfo.autoIncBuildNr) {
@ -1042,7 +1042,7 @@ bool MainWindow::compile(bool rebuild)
} else {
Editor * editor = mEditorList->getEditor();
if (editor != NULL ) {
ui->tableIssues->clearIssues();
clearIssues();
if (editor->modified()) {
if (!editor->save(false,false))
return false;
@ -1871,7 +1871,7 @@ void MainWindow::buildContextMenus()
ui->tableIssues);
connect(mTableIssuesClearAction,&QAction::triggered,
[this](){
ui->tableIssues->clearIssues();
clearIssues();
});
//context menu signal for search view
@ -2755,7 +2755,7 @@ void MainWindow::closeProject(bool refreshEditor)
}
if (!mQuitting) {
// Clear error browser
ui->tableIssues->clearIssues();
clearIssues();
updateProjectView();
}
}
@ -4491,6 +4491,15 @@ void MainWindow::setFilesViewRoot(const QString &path)
ui->txtFilesPath->setCursorPosition(1);
}
void MainWindow::clearIssues()
{
int i = ui->tabMessages->indexOf(ui->tabIssues);
if (i!=-1) {
ui->tabMessages->setTabText(i, tr("Issues"));
}
ui->tableIssues->clearIssues();
}
Ui::MainWindow *MainWindow::mainWidget() const
{
return ui;

View File

@ -195,6 +195,7 @@ private:
void includeOrSkipDirs(const QStringList& dirs, bool skip);
void showSearchReplacePanel(bool show);
void setFilesViewRoot(const QString& path);
void clearIssues();
private slots:
void onAutoSaveTimeout();