diff --git a/gui/checkthread.cpp b/gui/checkthread.cpp index c804330fe..be008543d 100644 --- a/gui/checkthread.cpp +++ b/gui/checkthread.cpp @@ -155,6 +155,8 @@ void CheckThread::runAddonsAndTools(const QString &addonPath, const ImportProjec if (!fileSettings->standard.empty()) args << ("-std=" + QString::fromStdString(fileSettings->standard)); + else + args << "-std=c++14"; QString analyzerInfoFile; @@ -194,12 +196,19 @@ void CheckThread::runAddonsAndTools(const QString &addonPath, const ImportProjec } if (addon == CLANG_ANALYZER) { + /* + // Using clang args.insert(0,"--analyze"); args.insert(1, "-Xanalyzer"); args.insert(2, "-analyzer-output=text"); args << fileName; + */ + // Using clang-tidy + args.insert(0,"-checks=-*,clang-analyzer-*"); + args.insert(1, fileName); + args.insert(2, "--"); } else { - args.insert(0,"-checks=*,-clang*,-llvm*"); + args.insert(0,"-checks=*,-clang-analyzer-*,-llvm*"); args.insert(1, fileName); args.insert(2, "--"); } @@ -209,8 +218,7 @@ void CheckThread::runAddonsAndTools(const QString &addonPath, const ImportProjec #else const QString ext = ""; #endif - const QString exename(addon == CLANG_ANALYZER ? ("clang" + ext) : ("clang-tidy" + ext)); - const QString cmd(mClangPath.isEmpty() ? exename : (mClangPath + '/' + exename)); + const QString cmd(mClangPath.isEmpty() ? ("clang-tidy" + ext) : (mClangPath + "/clang-tidy" + ext)); { QString debug(cmd.contains(" ") ? ('\"' + cmd + '\"') : cmd); foreach (QString arg, args) { diff --git a/gui/projectfile.cpp b/gui/projectfile.cpp index 6b8723e72..680ef1363 100644 --- a/gui/projectfile.cpp +++ b/gui/projectfile.cpp @@ -639,11 +639,12 @@ QStringList ProjectFile::fromNativeSeparators(const QStringList &paths) return ret; } -QStringList ProjectFile::getAddonsAndTools() const { - QStringList ret(mAddons); - if (mClangAnalyzer) - ret << CLANG_ANALYZER; - if (mClangTidy) - ret << CLANG_TIDY; - return ret; - } +QStringList ProjectFile::getAddonsAndTools() const +{ + QStringList ret(mAddons); + if (mClangAnalyzer) + ret << CLANG_ANALYZER; + if (mClangTidy) + ret << CLANG_TIDY; + return ret; +} diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp index a4a33f656..7802b8e92 100644 --- a/gui/projectfiledialog.cpp +++ b/gui/projectfiledialog.cpp @@ -147,7 +147,7 @@ void ProjectFileDialog::loadFromProjectFile(const ProjectFile *projectFile) mUI.mAddonThreadSafety->setChecked(projectFile->getAddons().contains("threadsafety")); mUI.mAddonY2038->setChecked(projectFile->getAddons().contains("y2038")); mUI.mAddonCert->setChecked(projectFile->getAddons().contains("cert")); - //mUI.mToolClangAnalyzer->setChecked(projectFile->getClangAnalyzer()); + mUI.mToolClangAnalyzer->setChecked(projectFile->getClangAnalyzer()); mUI.mToolClangTidy->setChecked(projectFile->getClangTidy()); QString tags; foreach (const QString tag, projectFile->getTags()) { @@ -180,7 +180,7 @@ void ProjectFileDialog::saveToProjectFile(ProjectFile *projectFile) const if (mUI.mAddonCert->isChecked()) list << "cert"; projectFile->setAddons(list); - //projectFile->setClangAnalyzer(mUI.mToolClangAnalyzer->isChecked()); + projectFile->setClangAnalyzer(mUI.mToolClangAnalyzer->isChecked()); projectFile->setClangTidy(mUI.mToolClangTidy->isChecked()); QStringList tags(mUI.mEditTags->text().split(";")); tags.removeAll(QString()); diff --git a/gui/projectfiledialog.ui b/gui/projectfiledialog.ui index 9594441a9..3e253e8f8 100644 --- a/gui/projectfiledialog.ui +++ b/gui/projectfiledialog.ui @@ -520,6 +520,13 @@ + + + + Clang analyzer + + +