GUI: Clang settings
This commit is contained in:
parent
2c837f2908
commit
f8c4d6cbc7
|
@ -145,10 +145,10 @@ void CheckThread::runAddons(const QString &addonPath, const ImportProject::FileS
|
||||||
// To create compile_commands.json in windows see:
|
// To create compile_commands.json in windows see:
|
||||||
// https://bitsmaker.gitlab.io/post/clang-tidy-from-vs2015/
|
// https://bitsmaker.gitlab.io/post/clang-tidy-from-vs2015/
|
||||||
|
|
||||||
foreach (QString s, mVsIncludePaths.split(";")) {
|
foreach (QString includePath, mClangIncludePaths) {
|
||||||
if (!s.isEmpty()) {
|
if (!includePath.isEmpty()) {
|
||||||
s.replace("\\", "/");
|
includePath.replace("\\", "/");
|
||||||
args << "-isystem" << s.trimmed();
|
args << "-isystem" << includePath.trimmed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,8 +157,6 @@ void CheckThread::runAddons(const QString &addonPath, const ImportProject::FileS
|
||||||
|
|
||||||
if (!fileSettings->standard.empty())
|
if (!fileSettings->standard.empty())
|
||||||
args << ("-std=" + QString::fromStdString(fileSettings->standard));
|
args << ("-std=" + QString::fromStdString(fileSettings->standard));
|
||||||
else if (!mVsIncludePaths.isEmpty() && fileName.endsWith(".cpp"))
|
|
||||||
args << "-std=c++14";
|
|
||||||
|
|
||||||
QString analyzerInfoFile;
|
QString analyzerInfoFile;
|
||||||
|
|
||||||
|
@ -239,6 +237,7 @@ void CheckThread::runAddons(const QString &addonPath, const ImportProject::FileS
|
||||||
out << errout;
|
out << errout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parseClangErrors(addon, fileName, errout);
|
parseClangErrors(addon, fileName, errout);
|
||||||
} else {
|
} else {
|
||||||
QString a;
|
QString a;
|
||||||
|
|
|
@ -56,10 +56,6 @@ public:
|
||||||
mAddons = addons;
|
mAddons = addons;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setVsIncludePaths(const QString &s) {
|
|
||||||
mVsIncludePaths = s;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setDataDir(const QString &dataDir) {
|
void setDataDir(const QString &dataDir) {
|
||||||
mDataDir = dataDir;
|
mDataDir = dataDir;
|
||||||
}
|
}
|
||||||
|
@ -68,6 +64,10 @@ public:
|
||||||
mClangPath = p;
|
mClangPath = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setClangIncludePaths(const QStringList &s) {
|
||||||
|
mClangIncludePaths = s;
|
||||||
|
}
|
||||||
|
|
||||||
void setSuppressions(const QStringList s) {
|
void setSuppressions(const QStringList s) {
|
||||||
mSuppressions = s;
|
mSuppressions = s;
|
||||||
}
|
}
|
||||||
|
@ -128,9 +128,9 @@ private:
|
||||||
QStringList mFiles;
|
QStringList mFiles;
|
||||||
bool mAnalyseWholeProgram;
|
bool mAnalyseWholeProgram;
|
||||||
QStringList mAddons;
|
QStringList mAddons;
|
||||||
QString mVsIncludePaths;
|
|
||||||
QString mDataDir;
|
QString mDataDir;
|
||||||
QString mClangPath;
|
QString mClangPath;
|
||||||
|
QStringList mClangIncludePaths;
|
||||||
QStringList mSuppressions;
|
QStringList mSuppressions;
|
||||||
};
|
};
|
||||||
/// @}
|
/// @}
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
#define SETTINGS_LANGUAGE "Application language"
|
#define SETTINGS_LANGUAGE "Application language"
|
||||||
#define SETTINGS_GLOBAL_INCLUDE_PATHS "Global include paths"
|
#define SETTINGS_GLOBAL_INCLUDE_PATHS "Global include paths"
|
||||||
#define SETTINGS_CLANG_PATH "Clang path"
|
#define SETTINGS_CLANG_PATH "Clang path"
|
||||||
#define SETTINGS_VS_INCLUDE_PATHS "Visual studio include paths"
|
#define SETTINGS_CLANG_HEADERS "Clang headers"
|
||||||
#define SETTINGS_INLINE_SUPPRESSIONS "Inline suppressions"
|
#define SETTINGS_INLINE_SUPPRESSIONS "Inline suppressions"
|
||||||
#define SETTINGS_INCONCLUSIVE_ERRORS "Inconclusive errors"
|
#define SETTINGS_INCONCLUSIVE_ERRORS "Inconclusive errors"
|
||||||
#define SETTINGS_MRU_PROJECTS "MRU Projects"
|
#define SETTINGS_MRU_PROJECTS "MRU Projects"
|
||||||
|
|
|
@ -444,7 +444,12 @@ void MainWindow::doAnalyzeProject(ImportProject p)
|
||||||
//mThread->SetanalyzeProject(true);
|
//mThread->SetanalyzeProject(true);
|
||||||
if (mProjectFile) {
|
if (mProjectFile) {
|
||||||
mThread->setAddons(mProjectFile->getAddons());
|
mThread->setAddons(mProjectFile->getAddons());
|
||||||
mThread->setVsIncludePaths(mSettings->value(SETTINGS_VS_INCLUDE_PATHS).toString());
|
QString clangHeaders = mSettings->value(SETTINGS_CLANG_HEADERS).toString();
|
||||||
|
QStringList includePaths;
|
||||||
|
if (!clangHeaders.isEmpty()) {
|
||||||
|
includePaths << clangHeaders << (clangHeaders+"/ATLMFC") << (clangHeaders+"/c++") << (clangHeaders+"/c++/i686-w64-mingw32");
|
||||||
|
}
|
||||||
|
mThread->setClangIncludePaths(includePaths);
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QString clangPath = mSettings->value(SETTINGS_CLANG_PATH,QString()).toString();
|
QString clangPath = mSettings->value(SETTINGS_CLANG_PATH,QString()).toString();
|
||||||
if (clangPath.isEmpty()) {
|
if (clangPath.isEmpty()) {
|
||||||
|
|
|
@ -351,53 +351,66 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="mLabelClangPath">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="text">
|
<property name="title">
|
||||||
<string>Clang path (leave empty to use system PATH)</string>
|
<string>Clang path (leave empty to use system PATH)</string>
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="mEditClangPath">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="mBtnBrowseClangPath">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<item>
|
<property name="title">
|
||||||
<widget class="QLineEdit" name="mEditClangPath">
|
<string>Clang headers</string>
|
||||||
<property name="readOnly">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="mBtnBrowseClangPath">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_5">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>51</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="mLabelVsIncludePaths">
|
|
||||||
<property name="text">
|
|
||||||
<string><html><head/><body><p>Visual Studio include paths.</p><p>Open Visual Studio Command Prompt. Type &quot;SET INSTALL&quot; and then copy paste the output here</p></body></html></string>
|
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="mLabelVsIncludePaths">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p>Download the "clang headers" archive and unpack it. You can get it here: <a href="http://sourceforge.net/projects/cppcheck/files/other/">http://sourceforge.net/projects/cppcheck/files/other</a></p>
|
||||||
|
<p>Path:</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="mEditClangHeaders">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="mButtonBrowseClangHeaders">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="mEditVsIncludePaths"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_6">
|
<spacer name="verticalSpacer_6">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
|
@ -57,8 +57,9 @@ SettingsDialog::SettingsDialog(ApplicationList *list,
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
//mUI.mTabClang->setVisible(true);
|
//mUI.mTabClang->setVisible(true);
|
||||||
mUI.mEditClangPath->setText(settings.value(SETTINGS_CLANG_PATH, QString()).toString());
|
mUI.mEditClangPath->setText(settings.value(SETTINGS_CLANG_PATH, QString()).toString());
|
||||||
mUI.mEditVsIncludePaths->setText(settings.value(SETTINGS_VS_INCLUDE_PATHS, QString()).toString());
|
mUI.mEditClangHeaders->setText(settings.value(SETTINGS_CLANG_HEADERS, QString()).toString());
|
||||||
connect(mUI.mBtnBrowseClangPath, &QPushButton::released, this, &SettingsDialog::browseClangPath);
|
connect(mUI.mBtnBrowseClangPath, &QPushButton::released, this, &SettingsDialog::browseClangPath);
|
||||||
|
connect(mUI.mButtonBrowseClangHeaders, &QPushButton::released, this, &SettingsDialog::browseClangHeaders);
|
||||||
#else
|
#else
|
||||||
mUI.mTabClang->setVisible(false);
|
mUI.mTabClang->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
|
@ -187,10 +188,7 @@ void SettingsDialog::saveSettingValues() const
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
settings.setValue(SETTINGS_CLANG_PATH, mUI.mEditClangPath->text());
|
settings.setValue(SETTINGS_CLANG_PATH, mUI.mEditClangPath->text());
|
||||||
QString vsIncludePaths = mUI.mEditVsIncludePaths->text();
|
settings.setValue(SETTINGS_CLANG_HEADERS, mUI.mEditClangHeaders->text());
|
||||||
if (vsIncludePaths.startsWith("INCLUDE="))
|
|
||||||
vsIncludePaths.remove(0, 8);
|
|
||||||
settings.setValue(SETTINGS_VS_INCLUDE_PATHS, vsIncludePaths);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const QListWidgetItem *currentLang = mUI.mListLanguages->currentItem();
|
const QListWidgetItem *currentLang = mUI.mListLanguages->currentItem();
|
||||||
|
@ -369,3 +367,16 @@ void SettingsDialog::browseClangPath()
|
||||||
mUI.mEditClangPath->setText(selectedDir);
|
mUI.mEditClangPath->setText(selectedDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::browseClangHeaders()
|
||||||
|
{
|
||||||
|
QString selectedDir = QFileDialog::getExistingDirectory(this,
|
||||||
|
tr("Select path for clang headers"),
|
||||||
|
QDir::homePath());
|
||||||
|
|
||||||
|
if (!selectedDir.isEmpty()) {
|
||||||
|
mUI.mEditClangHeaders->setText(selectedDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -145,6 +145,9 @@ protected slots:
|
||||||
/** @brief Slot for browsing for the clang binary */
|
/** @brief Slot for browsing for the clang binary */
|
||||||
void browseClangPath();
|
void browseClangPath();
|
||||||
|
|
||||||
|
/** @brief Slot for browsing for the clang headers */
|
||||||
|
void browseClangHeaders();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -95,8 +95,8 @@ void ThreadHandler::check(const Settings &settings)
|
||||||
for (int i = 0; i < mRunningThreadCount; i++) {
|
for (int i = 0; i < mRunningThreadCount; i++) {
|
||||||
mThreads[i]->setAddons(mAddons);
|
mThreads[i]->setAddons(mAddons);
|
||||||
mThreads[i]->setSuppressions(mSuppressions);
|
mThreads[i]->setSuppressions(mSuppressions);
|
||||||
mThreads[i]->setVsIncludePaths(mVsIncludePaths);
|
|
||||||
mThreads[i]->setClangPath(mClangPath);
|
mThreads[i]->setClangPath(mClangPath);
|
||||||
|
mThreads[i]->setClangIncludePaths(mClangIncludePaths);
|
||||||
mThreads[i]->setDataDir(mDataDir);
|
mThreads[i]->setDataDir(mDataDir);
|
||||||
mThreads[i]->check(settings);
|
mThreads[i]->check(settings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,14 +79,14 @@ public:
|
||||||
mSuppressions = s;
|
mSuppressions = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setVsIncludePaths(const QString &s) {
|
|
||||||
mVsIncludePaths = s;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setClangPath(const QString &p) {
|
void setClangPath(const QString &p) {
|
||||||
mClangPath = p;
|
mClangPath = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setClangIncludePaths(const QStringList &s) {
|
||||||
|
mClangIncludePaths = s;
|
||||||
|
}
|
||||||
|
|
||||||
void setDataDir(const QString &dataDir) {
|
void setDataDir(const QString &dataDir) {
|
||||||
mDataDir = dataDir;
|
mDataDir = dataDir;
|
||||||
}
|
}
|
||||||
|
@ -255,8 +255,8 @@ protected:
|
||||||
|
|
||||||
QStringList mAddons;
|
QStringList mAddons;
|
||||||
QStringList mSuppressions;
|
QStringList mSuppressions;
|
||||||
QString mVsIncludePaths;
|
|
||||||
QString mClangPath;
|
QString mClangPath;
|
||||||
|
QStringList mClangIncludePaths;
|
||||||
|
|
||||||
QString mDataDir;
|
QString mDataDir;
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue