2016-02-22 17:18:18 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "cpptools_global.h"
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/id.h>
|
|
|
|
|
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
#include <QVector>
|
|
|
|
|
|
2019-09-25 15:46:15 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QSettings;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2016-02-22 17:18:18 +01:00
|
|
|
namespace CppTools {
|
|
|
|
|
|
2019-09-25 15:46:15 +02:00
|
|
|
// TODO: Split this class as needed for ClangCodeModel and ClangTools
|
2016-02-22 17:18:18 +01:00
|
|
|
class CPPTOOLS_EXPORT ClangDiagnosticConfig
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Core::Id id() const;
|
|
|
|
|
void setId(const Core::Id &id);
|
|
|
|
|
|
|
|
|
|
QString displayName() const;
|
|
|
|
|
void setDisplayName(const QString &displayName);
|
|
|
|
|
|
2019-10-21 14:59:57 +02:00
|
|
|
bool isReadOnly() const;
|
|
|
|
|
void setIsReadOnly(bool isReadOnly);
|
|
|
|
|
|
2018-01-26 10:27:58 +01:00
|
|
|
QStringList clangOptions() const;
|
|
|
|
|
void setClangOptions(const QStringList &options);
|
|
|
|
|
|
2019-10-21 14:59:57 +02:00
|
|
|
bool useBuildSystemWarnings() const;
|
|
|
|
|
void setUseBuildSystemWarnings(bool useBuildSystemWarnings);
|
2018-02-23 11:36:18 +01:00
|
|
|
|
2019-10-21 14:59:57 +02:00
|
|
|
// Clang-Tidy
|
|
|
|
|
enum class TidyMode
|
|
|
|
|
{
|
2019-10-24 10:25:52 +02:00
|
|
|
// Disabled, // Used by Qt Creator 4.10 and below.
|
2019-10-24 11:31:42 +02:00
|
|
|
UseCustomChecks = 1,
|
|
|
|
|
UseConfigFile,
|
|
|
|
|
UseDefaultChecks,
|
2019-10-21 14:59:57 +02:00
|
|
|
};
|
2018-02-23 11:36:18 +01:00
|
|
|
TidyMode clangTidyMode() const;
|
|
|
|
|
void setClangTidyMode(TidyMode mode);
|
2018-01-26 10:27:58 +01:00
|
|
|
|
2019-10-21 14:59:57 +02:00
|
|
|
QString clangTidyChecks() const;
|
|
|
|
|
void setClangTidyChecks(const QString &checks);
|
2016-02-22 17:18:18 +01:00
|
|
|
|
2019-10-31 10:40:03 +01:00
|
|
|
bool isClangTidyEnabled() const;
|
|
|
|
|
|
2019-10-21 14:59:57 +02:00
|
|
|
// Clazy
|
|
|
|
|
enum class ClazyMode
|
|
|
|
|
{
|
2019-10-24 11:31:42 +02:00
|
|
|
UseDefaultChecks,
|
|
|
|
|
UseCustomChecks,
|
2019-10-21 14:59:57 +02:00
|
|
|
};
|
|
|
|
|
ClazyMode clazyMode() const;
|
|
|
|
|
void setClazyMode(const ClazyMode &clazyMode);
|
2016-02-22 17:18:18 +01:00
|
|
|
|
2019-10-21 14:59:57 +02:00
|
|
|
QString clazyChecks() const;
|
|
|
|
|
void setClazyChecks(const QString &checks);
|
2019-01-31 10:16:28 +01:00
|
|
|
|
2019-10-31 10:40:03 +01:00
|
|
|
bool isClazyEnabled() const;
|
|
|
|
|
|
2016-02-22 17:18:18 +01:00
|
|
|
bool operator==(const ClangDiagnosticConfig &other) const;
|
2018-01-19 13:18:43 +01:00
|
|
|
bool operator!=(const ClangDiagnosticConfig &other) const;
|
2016-02-22 17:18:18 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Core::Id m_id;
|
|
|
|
|
QString m_displayName;
|
2018-01-26 10:27:58 +01:00
|
|
|
QStringList m_clangOptions;
|
2019-10-24 11:31:42 +02:00
|
|
|
TidyMode m_clangTidyMode = TidyMode::UseDefaultChecks;
|
2018-05-16 07:58:53 +02:00
|
|
|
QString m_clangTidyChecks;
|
2018-01-26 10:27:58 +01:00
|
|
|
QString m_clazyChecks;
|
2019-10-24 11:31:42 +02:00
|
|
|
ClazyMode m_clazyMode = ClazyMode::UseDefaultChecks;
|
2016-02-22 17:18:18 +01:00
|
|
|
bool m_isReadOnly = false;
|
2019-01-31 10:16:28 +01:00
|
|
|
bool m_useBuildSystemWarnings = false;
|
2016-02-22 17:18:18 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using ClangDiagnosticConfigs = QVector<ClangDiagnosticConfig>;
|
|
|
|
|
|
2019-09-25 15:46:15 +02:00
|
|
|
ClangDiagnosticConfigs CPPTOOLS_EXPORT diagnosticConfigsFromSettings(QSettings *s);
|
|
|
|
|
void CPPTOOLS_EXPORT diagnosticConfigsToSettings(QSettings *s,
|
|
|
|
|
const ClangDiagnosticConfigs &configs);
|
|
|
|
|
|
2016-02-22 17:18:18 +01:00
|
|
|
} // namespace CppTools
|