forked from qt-creator/qt-creator
Clang: turn off delayed template parsing
Fix templates highlight and completion on Windows Add UI to turn on/off delayed parsing (off by default) Task-number: QTCREATORBUG-17222 Change-Id: I0cd5e0bcfff2789cd938e4096829f777ff15957a Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -419,16 +419,24 @@ static QStringList warningOptions(CppTools::ProjectPart *projectPart)
|
||||
{
|
||||
if (projectPart && projectPart->project) {
|
||||
ClangProjectSettings projectSettings(projectPart->project);
|
||||
if (!projectSettings.useGlobalWarningConfig()) {
|
||||
if (!projectSettings.useGlobalConfig()) {
|
||||
const Core::Id warningConfigId = projectSettings.warningConfigId();
|
||||
const CppTools::ClangDiagnosticConfigsModel configsModel(
|
||||
CppTools::codeModelSettings()->clangCustomDiagnosticConfigs());
|
||||
if (configsModel.hasConfigWithId(warningConfigId))
|
||||
return configsModel.configWithId(warningConfigId).commandLineOptions();
|
||||
return configsModel.configWithId(warningConfigId).commandLineWarnings();
|
||||
}
|
||||
}
|
||||
|
||||
return CppTools::codeModelSettings()->clangDiagnosticConfig().commandLineOptions();
|
||||
return CppTools::codeModelSettings()->clangDiagnosticConfig().commandLineWarnings();
|
||||
}
|
||||
|
||||
static QStringList commandLineOptions(CppTools::ProjectPart *projectPart)
|
||||
{
|
||||
if (!projectPart || !projectPart->project)
|
||||
return ClangProjectSettings::globalCommandLineOptions();
|
||||
|
||||
return ClangProjectSettings{projectPart->project}.commandLineOptions();
|
||||
}
|
||||
|
||||
static QStringList precompiledHeaderOptions(
|
||||
@@ -454,6 +462,7 @@ static QStringList fileArguments(const QString &filePath, CppTools::ProjectPart
|
||||
{
|
||||
return languageOptions(filePath, projectPart)
|
||||
+ warningOptions(projectPart)
|
||||
+ commandLineOptions(projectPart)
|
||||
+ precompiledHeaderOptions(filePath, projectPart);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,15 +25,23 @@
|
||||
|
||||
#include "clangprojectsettings.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
static QString useGlobalWarningConfigKey()
|
||||
{ return QStringLiteral("ClangCodeModel.UseGlobalWarningConfig"); }
|
||||
static QString useGlobalConfigKey()
|
||||
{ return QStringLiteral("ClangCodeModel.UseGlobalConfig"); }
|
||||
|
||||
static QString warningConfigIdKey()
|
||||
{ return QStringLiteral("ClangCodeModel.WarningConfigId"); }
|
||||
|
||||
static QString customCommandLineKey()
|
||||
{ return QLatin1String("ClangCodeModel.CustomCommandLineKey"); }
|
||||
|
||||
ClangProjectSettings::ClangProjectSettings(ProjectExplorer::Project *project)
|
||||
: m_project(project)
|
||||
{
|
||||
@@ -55,31 +63,55 @@ void ClangProjectSettings::setWarningConfigId(const Core::Id &customConfigId)
|
||||
m_warningConfigId = customConfigId;
|
||||
}
|
||||
|
||||
bool ClangProjectSettings::useGlobalWarningConfig() const
|
||||
bool ClangProjectSettings::useGlobalConfig() const
|
||||
{
|
||||
return m_useGlobalWarningConfig;
|
||||
return m_useGlobalConfig;
|
||||
}
|
||||
|
||||
void ClangProjectSettings::setUseGlobalWarningConfig(bool useGlobalWarningConfig)
|
||||
void ClangProjectSettings::setUseGlobalConfig(bool useGlobalConfig)
|
||||
{
|
||||
m_useGlobalWarningConfig = useGlobalWarningConfig;
|
||||
m_useGlobalConfig = useGlobalConfig;
|
||||
}
|
||||
|
||||
QStringList ClangProjectSettings::commandLineOptions() const
|
||||
{
|
||||
return m_useGlobalConfig ? globalCommandLineOptions()
|
||||
: m_customCommandLineOptions;
|
||||
}
|
||||
|
||||
void ClangProjectSettings::setCommandLineOptions(const QStringList &options)
|
||||
{
|
||||
QTC_ASSERT(!m_useGlobalConfig, qDebug()
|
||||
<< "setCommandLineOptions was called while using global project config");
|
||||
m_customCommandLineOptions = options;
|
||||
}
|
||||
|
||||
void ClangProjectSettings::load()
|
||||
{
|
||||
const QVariant useGlobalConfigVariant = m_project->namedSettings(useGlobalWarningConfigKey());
|
||||
const QVariant useGlobalConfigVariant = m_project->namedSettings(useGlobalConfigKey());
|
||||
const bool useGlobalConfig = useGlobalConfigVariant.isValid()
|
||||
? useGlobalConfigVariant.toBool()
|
||||
: true;
|
||||
|
||||
setUseGlobalWarningConfig(useGlobalConfig);
|
||||
setUseGlobalConfig(useGlobalConfig);
|
||||
setWarningConfigId(Core::Id::fromSetting(m_project->namedSettings(warningConfigIdKey())));
|
||||
m_customCommandLineOptions = m_project->namedSettings(customCommandLineKey()).toStringList();
|
||||
if (m_customCommandLineOptions.empty())
|
||||
m_customCommandLineOptions = globalCommandLineOptions();
|
||||
}
|
||||
|
||||
void ClangProjectSettings::store()
|
||||
{
|
||||
m_project->setNamedSettings(useGlobalWarningConfigKey(), useGlobalWarningConfig());
|
||||
m_project->setNamedSettings(useGlobalConfigKey(), useGlobalConfig());
|
||||
m_project->setNamedSettings(warningConfigIdKey(), warningConfigId().toSetting());
|
||||
m_project->setNamedSettings(customCommandLineKey(), m_customCommandLineOptions);
|
||||
}
|
||||
|
||||
QStringList ClangProjectSettings::globalCommandLineOptions()
|
||||
{
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
return {QLatin1String{GlobalWindowsCmdOptions}};
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -39,21 +39,32 @@ class ClangProjectSettings: public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
constexpr static const char* DelayedTemplateParsing = "-fdelayed-template-parsing";
|
||||
constexpr static const char* NoDelayedTemplateParsing = "-fno-delayed-template-parsing";
|
||||
constexpr static const char* GlobalWindowsCmdOptions = NoDelayedTemplateParsing;
|
||||
|
||||
ClangProjectSettings(ProjectExplorer::Project *project);
|
||||
|
||||
bool useGlobalWarningConfig() const;
|
||||
void setUseGlobalWarningConfig(bool useGlobalWarningConfig);
|
||||
bool useGlobalConfig() const;
|
||||
void setUseGlobalConfig(bool useGlobalConfig);
|
||||
|
||||
Core::Id warningConfigId() const;
|
||||
void setWarningConfigId(const Core::Id &warningConfigId);
|
||||
|
||||
QStringList commandLineOptions() const;
|
||||
void setCommandLineOptions(const QStringList &options);
|
||||
|
||||
void load();
|
||||
void store();
|
||||
|
||||
static QStringList globalCommandLineOptions();
|
||||
|
||||
private:
|
||||
ProjectExplorer::Project *m_project;
|
||||
bool m_useGlobalWarningConfig = true;
|
||||
bool m_useGlobalConfig = true;
|
||||
Core::Id m_warningConfigId;
|
||||
|
||||
QStringList m_customCommandLineOptions;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -34,60 +34,21 @@
|
||||
#include <cpptools/cppcodemodelsettings.h>
|
||||
#include <cpptools/cpptoolsreuse.h>
|
||||
|
||||
static const char GLOBAL_PROXY_CONFIG_ID[] = "globalProxyConfig";
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
static CppTools::ClangDiagnosticConfig
|
||||
createConfigRepresentingGlobalSetting(const CppTools::ClangDiagnosticConfig &baseConfig)
|
||||
static Core::Id configIdForProject(ClangProjectSettings &projectSettings)
|
||||
{
|
||||
CppTools::ClangDiagnosticConfig config = baseConfig;
|
||||
config.setId(GLOBAL_PROXY_CONFIG_ID);
|
||||
|
||||
QString displayName = config.displayName();
|
||||
if (config.isReadOnly())
|
||||
displayName = CppTools::ClangDiagnosticConfigsModel::displayNameWithBuiltinIndication(config);
|
||||
displayName = ClangProjectSettingsWidget::tr("Global setting (%1)").arg(displayName);
|
||||
|
||||
config.setDisplayName(displayName);
|
||||
config.setIsReadOnly(true);
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
static Core::Id globalConfigId(const CppTools::CppCodeModelSettings &settings,
|
||||
const CppTools::ClangDiagnosticConfigsModel &model)
|
||||
{
|
||||
const Core::Id configId = settings.clangDiagnosticConfigId();
|
||||
|
||||
if (model.hasConfigWithId(configId))
|
||||
return configId;
|
||||
|
||||
return model.at(0).id(); // Config saved in the settings was removed, fallback to first.
|
||||
}
|
||||
|
||||
static CppTools::ClangDiagnosticConfigsModel
|
||||
createConfigsModelWithGlobalProxyConfig(const CppTools::CppCodeModelSettings &settings)
|
||||
{
|
||||
using namespace CppTools;
|
||||
ClangDiagnosticConfigsModel configsModel(settings.clangCustomDiagnosticConfigs());
|
||||
|
||||
const Core::Id globalId = globalConfigId(settings, configsModel);
|
||||
const ClangDiagnosticConfig globalConfig = configsModel.configWithId(globalId);
|
||||
const ClangDiagnosticConfig globalProxy
|
||||
= createConfigRepresentingGlobalSetting(globalConfig);
|
||||
|
||||
configsModel.prepend(globalProxy);
|
||||
|
||||
return configsModel;
|
||||
}
|
||||
|
||||
static Core::Id configIdForProject(const ClangProjectSettings &projectSettings)
|
||||
{
|
||||
return projectSettings.useGlobalWarningConfig()
|
||||
? Core::Id(GLOBAL_PROXY_CONFIG_ID)
|
||||
: projectSettings.warningConfigId();
|
||||
if (projectSettings.useGlobalConfig())
|
||||
return CppTools::codeModelSettings()->clangDiagnosticConfigId();
|
||||
Core::Id configId = projectSettings.warningConfigId();
|
||||
if (!configId.isValid()) {
|
||||
configId = CppTools::codeModelSettings()->clangDiagnosticConfigId();
|
||||
projectSettings.setWarningConfigId(configId);
|
||||
}
|
||||
return configId;
|
||||
}
|
||||
|
||||
ClangProjectSettingsWidget::ClangProjectSettingsWidget(ProjectExplorer::Project *project)
|
||||
@@ -98,24 +59,33 @@ ClangProjectSettingsWidget::ClangProjectSettingsWidget(ProjectExplorer::Project
|
||||
using namespace CppTools;
|
||||
|
||||
m_diagnosticConfigWidget = new ClangDiagnosticConfigsWidget;
|
||||
m_diagnosticConfigWidget->setConfigWithUndecoratedDisplayName(Core::Id(GLOBAL_PROXY_CONFIG_ID));
|
||||
refreshDiagnosticConfigsWidgetFromSettings();
|
||||
|
||||
m_ui.generalConfigurationGroupBox->setVisible(Utils::HostOsInfo::isWindowsHost());
|
||||
|
||||
m_ui.clangSettings->setCurrentIndex(m_projectSettings.useGlobalConfig() ? 0 : 1);
|
||||
syncOtherWidgetsToComboBox();
|
||||
|
||||
connectToCppCodeModelSettingsChanged();
|
||||
connect(m_diagnosticConfigWidget.data(), &ClangDiagnosticConfigsWidget::currentConfigChanged,
|
||||
this, &ClangProjectSettingsWidget::onCurrentWarningConfigChanged);
|
||||
connect(m_diagnosticConfigWidget.data(), &ClangDiagnosticConfigsWidget::customConfigsChanged,
|
||||
this, &ClangProjectSettingsWidget::onCustomWarningConfigsChanged);
|
||||
connect(m_ui.delayedTemplateParse, &QCheckBox::toggled,
|
||||
this, &ClangProjectSettingsWidget::onDelayedTemplateParseClicked);
|
||||
connect(m_ui.clangSettings,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &ClangProjectSettingsWidget::onClangSettingsChanged);
|
||||
|
||||
m_ui.diagnosticConfigurationGroupBox->layout()->addWidget(m_diagnosticConfigWidget);
|
||||
}
|
||||
|
||||
void ClangProjectSettingsWidget::onCurrentWarningConfigChanged(const Core::Id ¤tConfigId)
|
||||
{
|
||||
const bool useGlobalConfig = currentConfigId == Core::Id(GLOBAL_PROXY_CONFIG_ID);
|
||||
|
||||
m_projectSettings.setUseGlobalWarningConfig(useGlobalConfig);
|
||||
// Don't save it when we reset the global config in code
|
||||
if (m_projectSettings.useGlobalConfig())
|
||||
return;
|
||||
m_projectSettings.setWarningConfigId(currentConfigId);
|
||||
|
||||
m_projectSettings.store();
|
||||
}
|
||||
|
||||
@@ -132,11 +102,48 @@ void ClangProjectSettingsWidget::onCustomWarningConfigsChanged(
|
||||
connectToCppCodeModelSettingsChanged();
|
||||
}
|
||||
|
||||
void ClangProjectSettingsWidget::onDelayedTemplateParseClicked(bool checked)
|
||||
{
|
||||
// Don't save it when we reset the global config in code
|
||||
if (m_projectSettings.useGlobalConfig())
|
||||
return;
|
||||
|
||||
const QLatin1String extraFlag{checked ? ClangProjectSettings::DelayedTemplateParsing
|
||||
: ClangProjectSettings::NoDelayedTemplateParsing};
|
||||
QStringList options = m_projectSettings.commandLineOptions();
|
||||
options.removeAll(QLatin1String{ClangProjectSettings::DelayedTemplateParsing});
|
||||
options.removeAll(QLatin1String{ClangProjectSettings::NoDelayedTemplateParsing});
|
||||
options.append(extraFlag);
|
||||
m_projectSettings.setCommandLineOptions(options);
|
||||
m_projectSettings.store();
|
||||
}
|
||||
|
||||
void ClangProjectSettingsWidget::onClangSettingsChanged(int index)
|
||||
{
|
||||
m_projectSettings.setUseGlobalConfig(index == 0 ? true : false);
|
||||
m_projectSettings.store();
|
||||
syncOtherWidgetsToComboBox();
|
||||
}
|
||||
|
||||
void ClangProjectSettingsWidget::syncOtherWidgetsToComboBox()
|
||||
{
|
||||
const QStringList options = m_projectSettings.commandLineOptions();
|
||||
m_ui.delayedTemplateParse->setChecked(
|
||||
options.contains(QLatin1String{ClangProjectSettings::DelayedTemplateParsing}));
|
||||
|
||||
const bool isCustom = !m_projectSettings.useGlobalConfig();
|
||||
m_ui.generalConfigurationGroupBox->setEnabled(isCustom);
|
||||
m_ui.diagnosticConfigurationGroupBox->setEnabled(isCustom);
|
||||
|
||||
refreshDiagnosticConfigsWidgetFromSettings();
|
||||
}
|
||||
|
||||
void ClangProjectSettingsWidget::refreshDiagnosticConfigsWidgetFromSettings()
|
||||
{
|
||||
m_diagnosticConfigWidget->refresh(
|
||||
createConfigsModelWithGlobalProxyConfig(*CppTools::codeModelSettings()),
|
||||
configIdForProject(m_projectSettings));
|
||||
CppTools::ClangDiagnosticConfigsModel configsModel(
|
||||
CppTools::codeModelSettings()->clangCustomDiagnosticConfigs());
|
||||
m_diagnosticConfigWidget->refresh(configsModel,
|
||||
configIdForProject(m_projectSettings));
|
||||
}
|
||||
|
||||
void ClangProjectSettingsWidget::connectToCppCodeModelSettingsChanged()
|
||||
|
||||
@@ -49,9 +49,12 @@ public:
|
||||
private:
|
||||
void onCurrentWarningConfigChanged(const Core::Id ¤tConfigId);
|
||||
void onCustomWarningConfigsChanged(const CppTools::ClangDiagnosticConfigs &customConfigs);
|
||||
void onDelayedTemplateParseClicked(bool);
|
||||
void onClangSettingsChanged(int index);
|
||||
void refreshDiagnosticConfigsWidgetFromSettings();
|
||||
void connectToCppCodeModelSettingsChanged();
|
||||
void disconnectFromCppCodeModelSettingsChanged();
|
||||
void syncOtherWidgetsToComboBox();
|
||||
|
||||
private:
|
||||
Ui::ClangProjectSettingsWidget m_ui;
|
||||
|
||||
@@ -14,6 +14,52 @@
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="clangSettings">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Global</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="generalConfigurationGroupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>General</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="delayedTemplateParse">
|
||||
<property name="toolTip">
|
||||
<string>Parse templates in a MSVC-compliant way. This helps to parse headers for example from Active Template Library (ATL) or Windows Runtime Library (WRL).
|
||||
However, using the relaxed and extended rules means also that no highlighting/completion can be provided within template functions.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable MSVC-compliant template parsing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="diagnosticConfigurationGroupBox">
|
||||
<property name="title">
|
||||
|
||||
@@ -47,14 +47,14 @@ void ClangDiagnosticConfig::setDisplayName(const QString &displayName)
|
||||
m_displayName = displayName;
|
||||
}
|
||||
|
||||
QStringList ClangDiagnosticConfig::commandLineOptions() const
|
||||
QStringList ClangDiagnosticConfig::commandLineWarnings() const
|
||||
{
|
||||
return m_commandLineOptions;
|
||||
return m_commandLineWarnings;
|
||||
}
|
||||
|
||||
void ClangDiagnosticConfig::setCommandLineOptions(const QStringList &options)
|
||||
void ClangDiagnosticConfig::setCommandLineWarnings(const QStringList &warnings)
|
||||
{
|
||||
m_commandLineOptions = options;
|
||||
m_commandLineWarnings = warnings;
|
||||
}
|
||||
|
||||
bool ClangDiagnosticConfig::isReadOnly() const
|
||||
@@ -71,7 +71,7 @@ bool ClangDiagnosticConfig::operator==(const ClangDiagnosticConfig &other) const
|
||||
{
|
||||
return m_id == other.m_id
|
||||
&& m_displayName == other.m_displayName
|
||||
&& m_commandLineOptions == other.m_commandLineOptions
|
||||
&& m_commandLineWarnings == other.m_commandLineWarnings
|
||||
&& m_isReadOnly == other.m_isReadOnly;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ public:
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &displayName);
|
||||
|
||||
QStringList commandLineOptions() const;
|
||||
void setCommandLineOptions(const QStringList &commandLineOptions);
|
||||
QStringList commandLineWarnings() const;
|
||||
void setCommandLineWarnings(const QStringList &commandLineWarnings);
|
||||
|
||||
bool isReadOnly() const;
|
||||
void setIsReadOnly(bool isReadOnly);
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
private:
|
||||
Core::Id m_id;
|
||||
QString m_displayName;
|
||||
QStringList m_commandLineOptions;
|
||||
QStringList m_commandLineWarnings;
|
||||
bool m_isReadOnly = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
static QStringList commonOptions()
|
||||
static QStringList commonWarnings()
|
||||
{
|
||||
return { QStringLiteral("-Wno-unknown-pragmas") };
|
||||
}
|
||||
@@ -45,10 +45,10 @@ static void addConfigForQuestionableConstructs(ClangDiagnosticConfigsModel &mode
|
||||
config.setDisplayName(QCoreApplication::translate("ClangDiagnosticConfigsModel",
|
||||
"Warnings for questionable constructs"));
|
||||
config.setIsReadOnly(true);
|
||||
config.setCommandLineOptions(QStringList{
|
||||
config.setCommandLineWarnings(QStringList{
|
||||
QStringLiteral("-Wall"),
|
||||
QStringLiteral("-Wextra"),
|
||||
} + commonOptions());
|
||||
} + commonWarnings());
|
||||
|
||||
model.appendOrUpdate(config);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ static void addConfigForPedanticWarnings(ClangDiagnosticConfigsModel &model)
|
||||
config.setDisplayName(QCoreApplication::translate("ClangDiagnosticConfigsModel",
|
||||
"Pedantic Warnings"));
|
||||
config.setIsReadOnly(true);
|
||||
config.setCommandLineOptions(QStringList{QStringLiteral("-Wpedantic")} + commonOptions());
|
||||
config.setCommandLineWarnings(QStringList{QStringLiteral("-Wpedantic")} + commonWarnings());
|
||||
|
||||
model.appendOrUpdate(config);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ static void addConfigForAlmostEveryWarning(ClangDiagnosticConfigsModel &model)
|
||||
config.setDisplayName(QCoreApplication::translate("ClangDiagnosticConfigsModel",
|
||||
"Warnings for almost everything"));
|
||||
config.setIsReadOnly(true);
|
||||
config.setCommandLineOptions(QStringList{
|
||||
config.setCommandLineWarnings(QStringList{
|
||||
QStringLiteral("-Weverything"),
|
||||
QStringLiteral("-Wno-c++98-compat"),
|
||||
QStringLiteral("-Wno-c++98-compat-pedantic"),
|
||||
@@ -85,7 +85,7 @@ static void addConfigForAlmostEveryWarning(ClangDiagnosticConfigsModel &model)
|
||||
QStringLiteral("-Wno-shadow"),
|
||||
QStringLiteral("-Wno-missing-prototypes"), // Not optimal for C projects.
|
||||
QStringLiteral("-Wno-used-but-marked-unused"), // e.g. QTest::qWait
|
||||
} + commonOptions());
|
||||
} + commonWarnings());
|
||||
|
||||
model.appendOrUpdate(config);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ void ClangDiagnosticConfigsWidget::onDiagnosticOptionsEdited()
|
||||
= diagnosticOptions.trimmed().split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
|
||||
ClangDiagnosticConfig updatedConfig = currentConfig();
|
||||
updatedConfig.setCommandLineOptions(updatedCommandLine);
|
||||
updatedConfig.setCommandLineWarnings(updatedCommandLine);
|
||||
|
||||
m_diagnosticConfigsModel.appendOrUpdate(updatedConfig);
|
||||
emit customConfigsChanged(customConfigs());
|
||||
@@ -127,15 +127,6 @@ void ClangDiagnosticConfigsWidget::syncWidgetsToModel(const Core::Id &configToSe
|
||||
syncOtherWidgetsToComboBox();
|
||||
}
|
||||
|
||||
static QString displayNameWithBuiltinIndication(const ClangDiagnosticConfig &config,
|
||||
const Core::Id &exceptionalConfig)
|
||||
{
|
||||
if (exceptionalConfig == config.id())
|
||||
return config.displayName();
|
||||
|
||||
return ClangDiagnosticConfigsModel::displayNameWithBuiltinIndication(config);
|
||||
}
|
||||
|
||||
void ClangDiagnosticConfigsWidget::syncConfigChooserToModel(const Core::Id &configToSelect)
|
||||
{
|
||||
disconnectConfigChooserCurrentIndex();
|
||||
@@ -148,7 +139,7 @@ void ClangDiagnosticConfigsWidget::syncConfigChooserToModel(const Core::Id &conf
|
||||
for (int i = 0; i < size; ++i) {
|
||||
const ClangDiagnosticConfig &config = m_diagnosticConfigsModel.at(i);
|
||||
const QString displayName
|
||||
= displayNameWithBuiltinIndication(config, m_configWithUndecoratedDisplayName);
|
||||
= ClangDiagnosticConfigsModel::displayNameWithBuiltinIndication(config);
|
||||
m_ui->configChooserComboBox->addItem(displayName, config.id().toSetting());
|
||||
|
||||
if (configToSelect == config.id())
|
||||
@@ -176,8 +167,8 @@ void ClangDiagnosticConfigsWidget::syncOtherWidgetsToComboBox()
|
||||
m_ui->removeButton->setEnabled(!config.isReadOnly());
|
||||
|
||||
// Update child widgets
|
||||
const QString commandLineOptions = config.commandLineOptions().join(QLatin1Char(' '));
|
||||
setDiagnosticOptions(commandLineOptions);
|
||||
const QString commandLineWarnings = config.commandLineWarnings().join(QLatin1Char(' '));
|
||||
setDiagnosticOptions(commandLineWarnings);
|
||||
m_ui->diagnosticOptionsTextEdit->setReadOnly(config.isReadOnly());
|
||||
}
|
||||
|
||||
@@ -228,11 +219,6 @@ void ClangDiagnosticConfigsWidget::disconnectDiagnosticOptionsChanged()
|
||||
this, &ClangDiagnosticConfigsWidget::onDiagnosticOptionsEdited);
|
||||
}
|
||||
|
||||
void ClangDiagnosticConfigsWidget::setConfigWithUndecoratedDisplayName(const Core::Id &id)
|
||||
{
|
||||
m_configWithUndecoratedDisplayName = id;
|
||||
}
|
||||
|
||||
Core::Id ClangDiagnosticConfigsWidget::currentConfigId() const
|
||||
{
|
||||
return Core::Id::fromSetting(m_ui->configChooserComboBox->currentData());
|
||||
|
||||
@@ -50,7 +50,6 @@ public:
|
||||
Core::Id currentConfigId() const;
|
||||
ClangDiagnosticConfigs customConfigs() const;
|
||||
|
||||
void setConfigWithUndecoratedDisplayName(const Core::Id &id);
|
||||
void refresh(const ClangDiagnosticConfigsModel &diagnosticConfigsModel,
|
||||
const Core::Id &configToSelect);
|
||||
|
||||
@@ -82,7 +81,6 @@ private:
|
||||
private:
|
||||
Ui::ClangDiagnosticConfigsWidget *m_ui;
|
||||
ClangDiagnosticConfigsModel m_diagnosticConfigsModel;
|
||||
Core::Id m_configWithUndecoratedDisplayName;
|
||||
};
|
||||
|
||||
} // CppTools namespace
|
||||
|
||||
@@ -52,7 +52,7 @@ static QString clangDiagnosticConfigsArrayIdKey()
|
||||
static QString clangDiagnosticConfigsArrayDisplayNameKey()
|
||||
{ return QLatin1String("displayName"); }
|
||||
|
||||
static QString clangDiagnosticConfigsArrayOptionsKey()
|
||||
static QString clangDiagnosticConfigsArrayWarningsKey()
|
||||
{ return QLatin1String("diagnosticOptions"); }
|
||||
|
||||
static QString pchUsageKey()
|
||||
@@ -78,7 +78,7 @@ void CppCodeModelSettings::fromSettings(QSettings *s)
|
||||
ClangDiagnosticConfig config;
|
||||
config.setId(Core::Id::fromSetting(s->value(clangDiagnosticConfigsArrayIdKey())));
|
||||
config.setDisplayName(s->value(clangDiagnosticConfigsArrayDisplayNameKey()).toString());
|
||||
config.setCommandLineOptions(s->value(clangDiagnosticConfigsArrayOptionsKey()).toStringList());
|
||||
config.setCommandLineWarnings(s->value(clangDiagnosticConfigsArrayWarningsKey()).toStringList());
|
||||
m_clangCustomDiagnosticConfigs.append(config);
|
||||
}
|
||||
s->endArray();
|
||||
@@ -117,7 +117,7 @@ void CppCodeModelSettings::toSettings(QSettings *s)
|
||||
s->setArrayIndex(i);
|
||||
s->setValue(clangDiagnosticConfigsArrayIdKey(), config.id().toSetting());
|
||||
s->setValue(clangDiagnosticConfigsArrayDisplayNameKey(), config.displayName());
|
||||
s->setValue(clangDiagnosticConfigsArrayOptionsKey(), config.commandLineOptions());
|
||||
s->setValue(clangDiagnosticConfigsArrayWarningsKey(), config.commandLineWarnings());
|
||||
}
|
||||
s->endArray();
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ ProjectPart::ProjectPart(const Utf8String &projectPartId)
|
||||
}
|
||||
|
||||
ProjectPart::ProjectPart(const Utf8String &projectPartId,
|
||||
std::initializer_list<Utf8String> arguments)
|
||||
const Utf8StringVector &arguments)
|
||||
: d(std::make_shared<ProjectPartData>(projectPartId))
|
||||
{
|
||||
setArguments(arguments);
|
||||
|
||||
@@ -42,7 +42,7 @@ class ProjectPart
|
||||
{
|
||||
public:
|
||||
ProjectPart(const Utf8String &id = Utf8String());
|
||||
ProjectPart(const Utf8String &id, std::initializer_list<Utf8String> arguments);
|
||||
ProjectPart(const Utf8String &id, const Utf8StringVector &arguments);
|
||||
ProjectPart(const ProjectPartContainer &projectContainer);
|
||||
~ProjectPart();
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "googletest.h"
|
||||
#include "testenvironment.h"
|
||||
|
||||
#include <clangcodecompleteresults.h>
|
||||
#include <clangdocument.h>
|
||||
@@ -148,7 +149,7 @@ protected:
|
||||
bool needsReparse = false);
|
||||
|
||||
protected:
|
||||
ClangBackEnd::ProjectPart project{Utf8StringLiteral("/path/to/projectfile")};
|
||||
ClangBackEnd::ProjectPart project{Utf8StringLiteral("/path/to/projectfile"), TestEnvironment::addPlatformArguments()};
|
||||
ClangBackEnd::ProjectParts projects;
|
||||
ClangBackEnd::UnsavedFiles unsavedFiles;
|
||||
ClangBackEnd::Documents documents{projects, unsavedFiles};
|
||||
@@ -197,7 +198,7 @@ TEST_F(CodeCompletionsExtractorSlowTest, Variable)
|
||||
CodeCompletion::Available));
|
||||
}
|
||||
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(NonTypeTemplateParameter))
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, NonTypeTemplateParameter)
|
||||
{
|
||||
ClangCodeCompleteResults completeResults(getResults(variableDocument, 25, 19));
|
||||
|
||||
@@ -242,7 +243,7 @@ TEST_F(CodeCompletionsExtractorSlowTest, Field)
|
||||
CodeCompletion::Available));
|
||||
}
|
||||
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(Class))
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, Class)
|
||||
{
|
||||
ClangCodeCompleteResults completeResults(getResults(classDocument, 20));
|
||||
|
||||
@@ -253,7 +254,7 @@ TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(Class))
|
||||
CodeCompletion::Available));
|
||||
}
|
||||
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(Struct))
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, Struct)
|
||||
{
|
||||
ClangCodeCompleteResults completeResults(getResults(classDocument, 20));
|
||||
|
||||
@@ -264,7 +265,7 @@ TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(Struct))
|
||||
CodeCompletion::Available));
|
||||
}
|
||||
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(Union))
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, Union)
|
||||
{
|
||||
ClangCodeCompleteResults completeResults(getResults(classDocument, 20));
|
||||
|
||||
@@ -275,7 +276,7 @@ TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(Union))
|
||||
CodeCompletion::Available));
|
||||
}
|
||||
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(Typedef))
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, Typedef)
|
||||
{
|
||||
ClangCodeCompleteResults completeResults(getResults(classDocument, 20));
|
||||
|
||||
@@ -286,7 +287,7 @@ TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(Typedef))
|
||||
CodeCompletion::Available));
|
||||
}
|
||||
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(UsingAsTypeAlias))
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, UsingAsTypeAlias)
|
||||
{
|
||||
ClangCodeCompleteResults completeResults(getResults(classDocument, 20));
|
||||
|
||||
@@ -297,7 +298,7 @@ TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(UsingAsTypeAlias))
|
||||
CodeCompletion::Available));
|
||||
}
|
||||
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(TemplateTypeParameter))
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, TemplateTypeParameter)
|
||||
{
|
||||
ClangCodeCompleteResults completeResults(getResults(classDocument, 20));
|
||||
|
||||
@@ -308,7 +309,7 @@ TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(TemplateTypeParamet
|
||||
CodeCompletion::Available));
|
||||
}
|
||||
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(TemplateClass))
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, TemplateClass)
|
||||
{
|
||||
ClangCodeCompleteResults completeResults(getResults(classDocument, 20));
|
||||
|
||||
@@ -319,7 +320,7 @@ TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(TemplateClass))
|
||||
CodeCompletion::Available));
|
||||
}
|
||||
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(TemplateTemplateParameter))
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, TemplateTemplateParameter)
|
||||
{
|
||||
ClangCodeCompleteResults completeResults(getResults(classDocument, 20));
|
||||
|
||||
@@ -330,7 +331,7 @@ TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(TemplateTemplatePar
|
||||
CodeCompletion::Available));
|
||||
}
|
||||
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(ClassTemplatePartialSpecialization))
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, ClassTemplatePartialSpecialization)
|
||||
{
|
||||
ClangCodeCompleteResults completeResults(getResults(classDocument, 20));
|
||||
|
||||
@@ -659,7 +660,7 @@ TEST_F(CodeCompletionsExtractorSlowTest, CompletionChunksEnumeration)
|
||||
CodeCompletionChunks({{CodeCompletionChunk::TypedText, Utf8StringLiteral("Enumeration")}})));
|
||||
}
|
||||
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, DISABLED_ON_WINDOWS(CompletionChunksClass))
|
||||
TEST_F(CodeCompletionsExtractorSlowTest, CompletionChunksClass)
|
||||
{
|
||||
ClangCodeCompleteResults completeResults(getResults(classDocument, 20));
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "googletest.h"
|
||||
|
||||
#include "clangcompareoperators.h"
|
||||
#include "testenvironment.h"
|
||||
|
||||
#include <clangdocument.h>
|
||||
#include <clangdocuments.h>
|
||||
@@ -66,7 +67,7 @@ struct Data {
|
||||
Utf8String filePath{Utf8StringLiteral(TESTDATA_DIR"/cursor.cpp")};
|
||||
Document document{filePath,
|
||||
ProjectPart(Utf8StringLiteral("projectPartId"),
|
||||
{Utf8StringLiteral("-std=c++11")}),
|
||||
TestEnvironment::addPlatformArguments({Utf8StringLiteral("-std=c++11")})),
|
||||
{},
|
||||
documents};
|
||||
TranslationUnit translationUnit{filePath,
|
||||
@@ -395,7 +396,7 @@ TEST_F(Cursor, IsLocalVariableInStaticFunction)
|
||||
ASSERT_TRUE(cursor.isLocalVariable());
|
||||
}
|
||||
|
||||
TEST_F(Cursor, DISABLED_ON_WINDOWS(IsLocalVariableInTemplateFunction))
|
||||
TEST_F(Cursor, IsLocalVariableInTemplateFunction)
|
||||
{
|
||||
auto cursor = translationUnit.cursorAt(52, 7);
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "googletest.h"
|
||||
#include "diagnosticcontainer-matcher.h"
|
||||
#include "testenvironment.h"
|
||||
|
||||
#include <diagnostic.h>
|
||||
#include <diagnosticcontainer.h>
|
||||
@@ -95,7 +96,8 @@ struct Data {
|
||||
d.reset(new DiagnosticData(document));
|
||||
}
|
||||
|
||||
ProjectPart projectPart{Utf8StringLiteral("projectPartId"), {Utf8StringLiteral("-std=c++11")}};
|
||||
ProjectPart projectPart{Utf8StringLiteral("projectPartId"),
|
||||
TestEnvironment::addPlatformArguments({Utf8StringLiteral("-std=c++11")})};
|
||||
ClangBackEnd::ProjectParts projects;
|
||||
ClangBackEnd::UnsavedFiles unsavedFiles;
|
||||
ClangBackEnd::Documents documents{projects, unsavedFiles};
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "googletest.h"
|
||||
#include "diagnosticcontainer-matcher.h"
|
||||
#include "testenvironment.h"
|
||||
|
||||
#include <clangbackendipc_global.h>
|
||||
#include <clangdocument.h>
|
||||
@@ -63,7 +64,8 @@ const Utf8String headerFilePath = Utf8StringLiteral(TESTDATA_DIR"/diagnostic_dia
|
||||
class DiagnosticSet : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
ProjectPart projectPart{Utf8StringLiteral("projectPartId"), {Utf8StringLiteral("-pedantic")}};
|
||||
ProjectPart projectPart{Utf8StringLiteral("projectPartId"),
|
||||
TestEnvironment::addPlatformArguments({Utf8StringLiteral("-pedantic")})};
|
||||
ClangBackEnd::ProjectParts projects;
|
||||
ClangBackEnd::UnsavedFiles unsavedFiles;
|
||||
ClangBackEnd::Documents documents{projects, unsavedFiles};
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "googletest.h"
|
||||
#include "testenvironment.h"
|
||||
|
||||
#include <clangdocument.h>
|
||||
#include <clangdocuments.h>
|
||||
@@ -107,7 +108,8 @@ struct Data {
|
||||
Utf8String filePath{Utf8StringLiteral(TESTDATA_DIR"/highlightingmarks.cpp")};
|
||||
Document document{filePath,
|
||||
ProjectPart(Utf8StringLiteral("projectPartId"),
|
||||
{Utf8StringLiteral("-std=c++14"), Utf8StringLiteral("-I" TESTDATA_DIR)}),
|
||||
TestEnvironment::addPlatformArguments({Utf8StringLiteral("-std=c++14"),
|
||||
Utf8StringLiteral("-I" TESTDATA_DIR)})),
|
||||
{},
|
||||
documents};
|
||||
TranslationUnit translationUnit{filePath,
|
||||
@@ -676,49 +678,49 @@ TEST_F(HighlightingMarks, TemplateFunctionDeclaration)
|
||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Function));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_ON_WINDOWS(TemplateTypeParameterReference))
|
||||
TEST_F(HighlightingMarks, TemplateTypeParameterReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(268, 58));
|
||||
|
||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_ON_WINDOWS(TemplateTypeParameterDeclarationReference))
|
||||
TEST_F(HighlightingMarks, TemplateTypeParameterDeclarationReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(268, 58));
|
||||
|
||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_ON_WINDOWS(NonTypeTemplateParameterReference))
|
||||
TEST_F(HighlightingMarks, NonTypeTemplateParameterReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(269, 71));
|
||||
|
||||
ASSERT_THAT(infos[3], HasOnlyType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_ON_WINDOWS(NonTypeTemplateParameterReferenceReference))
|
||||
TEST_F(HighlightingMarks, NonTypeTemplateParameterReferenceReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(269, 71));
|
||||
|
||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_ON_WINDOWS(TemplateTemplateParameterReference))
|
||||
TEST_F(HighlightingMarks, TemplateTemplateParameterReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(270, 89));
|
||||
|
||||
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_ON_WINDOWS(TemplateTemplateContainerParameterReference))
|
||||
TEST_F(HighlightingMarks, TemplateTemplateContainerParameterReference)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(270, 89));
|
||||
|
||||
ASSERT_THAT(infos[2], HasOnlyType(HighlightingType::Type));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, DISABLED_ON_WINDOWS(TemplateTemplateParameterReferenceVariable))
|
||||
TEST_F(HighlightingMarks, TemplateTemplateParameterReferenceVariable)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(270, 89));
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "googletest.h"
|
||||
#include "testenvironment.h"
|
||||
|
||||
#include <chunksreportedmonitor.h>
|
||||
#include <clangdocument.h>
|
||||
@@ -55,7 +56,7 @@ struct Data {
|
||||
Documents documents{projects, unsavedFiles};
|
||||
Document document{Utf8StringLiteral(TESTDATA_DIR"/highlightingmarks.cpp"),
|
||||
ProjectPart(Utf8StringLiteral("projectPartId"),
|
||||
{Utf8StringLiteral("-std=c++14")}),
|
||||
TestEnvironment::addPlatformArguments({Utf8StringLiteral("-std=c++14")})),
|
||||
{},
|
||||
documents};
|
||||
};
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "googletest.h"
|
||||
#include "testenvironment.h"
|
||||
|
||||
#include <cursor.h>
|
||||
#include <clangdocument.h>
|
||||
@@ -94,8 +95,8 @@ struct Data {
|
||||
Utf8String filePath = Utf8StringLiteral(TESTDATA_DIR"/skippedsourceranges.cpp");
|
||||
Document document{filePath,
|
||||
ProjectPart(Utf8StringLiteral("projectPartId"),
|
||||
{Utf8StringLiteral("-std=c++11"),
|
||||
Utf8StringLiteral("-DBLAH")}),
|
||||
TestEnvironment::addPlatformArguments({Utf8StringLiteral("-std=c++11"),
|
||||
Utf8StringLiteral("-DBLAH")})),
|
||||
{},
|
||||
documents};
|
||||
TranslationUnit translationUnit{filePath,
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "googletest.h"
|
||||
#include "testenvironment.h"
|
||||
|
||||
#include <clangtranslationunit.h>
|
||||
#include <diagnostic.h>
|
||||
@@ -93,7 +94,8 @@ struct Data {
|
||||
d.reset(new SourceRangeData(document));
|
||||
}
|
||||
|
||||
ProjectPart projectPart{Utf8StringLiteral("projectPartId"), {Utf8StringLiteral("-pedantic")}};
|
||||
ProjectPart projectPart{Utf8StringLiteral("projectPartId"),
|
||||
TestEnvironment::addPlatformArguments({Utf8StringLiteral("-pedantic")})};
|
||||
ClangBackEnd::ProjectParts projects;
|
||||
ClangBackEnd::UnsavedFiles unsavedFiles;
|
||||
ClangBackEnd::Documents documents{projects, unsavedFiles};
|
||||
|
||||
@@ -27,7 +27,11 @@
|
||||
|
||||
#include <environment.h>
|
||||
|
||||
#include <utf8string.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
#include <QTemporaryDir>
|
||||
#include <QVector>
|
||||
|
||||
class TestEnvironment final : public ClangBackEnd::Environment
|
||||
{
|
||||
@@ -50,6 +54,14 @@ public:
|
||||
return 2;
|
||||
}
|
||||
|
||||
static QVector<Utf8String> addPlatformArguments(std::initializer_list<Utf8String> arguments = {})
|
||||
{
|
||||
QVector<Utf8String> result{arguments};
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
result.append(Utf8StringLiteral("-fno-delayed-template-parsing"));
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
QTemporaryDir temporaryDirectory;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user