GUI: Add 'Clang Analyzer' option
This commit is contained in:
parent
6ddcfc3d1c
commit
791f6ecbec
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -520,6 +520,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="mToolClangAnalyzer">
|
||||
<property name="text">
|
||||
<string>Clang analyzer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="mToolClangTidy">
|
||||
<property name="text">
|
||||
|
|
Loading…
Reference in New Issue