2014-04-29 23:20:10 +08:00
|
|
|
//===--- ClangTidyOptions.h - clang-tidy ------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2014-04-29 23:20:10 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-03-10 00:52:33 +08:00
|
|
|
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYOPTIONS_H
|
|
|
|
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYOPTIONS_H
|
2014-04-29 23:20:10 +08:00
|
|
|
|
2018-10-10 21:27:25 +08:00
|
|
|
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
2014-09-04 22:23:36 +08:00
|
|
|
#include "llvm/ADT/Optional.h"
|
|
|
|
#include "llvm/ADT/StringMap.h"
|
2014-06-05 21:31:45 +08:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2014-09-04 22:23:36 +08:00
|
|
|
#include "llvm/Support/ErrorOr.h"
|
2018-10-10 21:27:25 +08:00
|
|
|
#include "llvm/Support/VirtualFileSystem.h"
|
2014-10-20 20:29:15 +08:00
|
|
|
#include <functional>
|
2014-05-05 22:54:47 +08:00
|
|
|
#include <string>
|
2014-06-13 00:53:02 +08:00
|
|
|
#include <system_error>
|
2014-05-23 00:07:11 +08:00
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
2014-05-05 22:54:47 +08:00
|
|
|
|
2014-04-29 23:20:10 +08:00
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Contains a list of line ranges in a single file.
|
2014-05-23 00:07:11 +08:00
|
|
|
struct FileFilter {
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// File name.
|
2014-05-23 00:07:11 +08:00
|
|
|
std::string Name;
|
2014-06-05 21:31:45 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// LineRange is a pair<start, end> (inclusive).
|
2014-05-23 00:07:11 +08:00
|
|
|
typedef std::pair<unsigned, unsigned> LineRange;
|
2014-06-05 21:31:45 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// A list of line ranges in this file, for which we show warnings.
|
2014-05-23 00:07:11 +08:00
|
|
|
std::vector<LineRange> LineRanges;
|
|
|
|
};
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Global options. These options are neither stored nor read from
|
2014-06-05 21:31:45 +08:00
|
|
|
/// configuration files.
|
|
|
|
struct ClangTidyGlobalOptions {
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Output warnings from certain line ranges of certain files only.
|
2014-06-12 19:25:45 +08:00
|
|
|
/// If empty, no warnings will be filtered.
|
2014-06-05 21:31:45 +08:00
|
|
|
std::vector<FileFilter> LineFilter;
|
|
|
|
};
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Contains options for clang-tidy. These options may be read from
|
2014-06-05 21:31:45 +08:00
|
|
|
/// configuration files, and may be different for different translation units.
|
2014-04-29 23:20:10 +08:00
|
|
|
struct ClangTidyOptions {
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// These options are used for all settings that haven't been
|
2014-09-04 22:23:36 +08:00
|
|
|
/// overridden by the \c OptionsProvider.
|
|
|
|
///
|
2014-10-16 19:27:57 +08:00
|
|
|
/// Allow no checks and no headers by default. This method initializes
|
|
|
|
/// check-specific options by calling \c ClangTidyModule::getModuleOptions()
|
|
|
|
/// of each registered \c ClangTidyModule.
|
|
|
|
static ClangTidyOptions getDefaults();
|
2014-09-04 22:23:36 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Creates a new \c ClangTidyOptions instance combined from all fields
|
2014-09-04 22:23:36 +08:00
|
|
|
/// of this instance overridden by the fields of \p Other that have a value.
|
2020-04-01 17:08:53 +08:00
|
|
|
/// \p Order specifies precedence of \p Other option.
|
|
|
|
ClangTidyOptions mergeWith(const ClangTidyOptions &Other,
|
|
|
|
unsigned Order) const;
|
2014-06-05 21:31:45 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Checks filter.
|
2014-09-04 22:23:36 +08:00
|
|
|
llvm::Optional<std::string> Checks;
|
2014-05-23 00:07:11 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// WarningsAsErrors filter.
|
2016-01-14 01:36:41 +08:00
|
|
|
llvm::Optional<std::string> WarningsAsErrors;
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Output warnings from headers matching this filter. Warnings from
|
2014-06-05 21:31:45 +08:00
|
|
|
/// main files will always be displayed.
|
2014-09-04 22:23:36 +08:00
|
|
|
llvm::Optional<std::string> HeaderFilterRegex;
|
2014-05-23 00:07:11 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Output warnings from system headers matching \c HeaderFilterRegex.
|
2014-10-29 06:16:13 +08:00
|
|
|
llvm::Optional<bool> SystemHeaders;
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Format code around applied fixes with clang-format using this
|
2017-04-06 21:41:29 +08:00
|
|
|
/// style.
|
|
|
|
///
|
|
|
|
/// Can be one of:
|
|
|
|
/// * 'none' - don't format code around applied fixes;
|
|
|
|
/// * 'llvm', 'google', 'mozilla' or other predefined clang-format style
|
|
|
|
/// names;
|
|
|
|
/// * 'file' - use the .clang-format file in the closest parent directory of
|
|
|
|
/// each source file;
|
|
|
|
/// * '{inline-formatting-style-in-yaml-format}'.
|
|
|
|
///
|
|
|
|
/// See clang-format documentation for more about configuring format style.
|
|
|
|
llvm::Optional<std::string> FormatStyle;
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Specifies the name or e-mail of the user running clang-tidy.
|
2014-09-25 02:36:03 +08:00
|
|
|
///
|
|
|
|
/// This option is used, for example, to place the correct user name in TODO()
|
|
|
|
/// comments in the relevant check.
|
|
|
|
llvm::Optional<std::string> User;
|
|
|
|
|
2020-04-01 17:08:53 +08:00
|
|
|
/// Helper structure for storing option value with priority of the value.
|
|
|
|
struct ClangTidyValue {
|
|
|
|
ClangTidyValue() : Value(), Priority(0) {}
|
|
|
|
ClangTidyValue(const char *Value) : Value(Value), Priority(0) {}
|
|
|
|
ClangTidyValue(llvm::StringRef Value, unsigned Priority = 0)
|
|
|
|
: Value(Value), Priority(Priority) {}
|
|
|
|
|
|
|
|
std::string Value;
|
|
|
|
/// Priority stores relative precedence of the value loaded from config
|
|
|
|
/// files to disambigute local vs global value from different levels.
|
|
|
|
unsigned Priority;
|
|
|
|
};
|
2014-09-12 16:53:36 +08:00
|
|
|
typedef std::pair<std::string, std::string> StringPair;
|
2020-07-30 17:31:12 +08:00
|
|
|
typedef llvm::StringMap<ClangTidyValue> OptionMap;
|
2014-09-12 16:53:36 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Key-value mapping used to store check-specific options.
|
2014-09-12 16:53:36 +08:00
|
|
|
OptionMap CheckOptions;
|
2015-11-10 00:28:11 +08:00
|
|
|
|
|
|
|
typedef std::vector<std::string> ArgList;
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Add extra compilation arguments to the end of the list.
|
2015-11-10 00:28:11 +08:00
|
|
|
llvm::Optional<ArgList> ExtraArgs;
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Add extra compilation arguments to the start of the list.
|
2015-11-10 00:28:11 +08:00
|
|
|
llvm::Optional<ArgList> ExtraArgsBefore;
|
2020-04-01 17:08:53 +08:00
|
|
|
|
2020-06-19 19:02:08 +08:00
|
|
|
/// Only used in the FileOptionsProvider and ConfigOptionsProvider. If true
|
|
|
|
/// and using a FileOptionsProvider, it will take a configuration file in the
|
|
|
|
/// parent directory (if any exists) and apply this config file on top of the
|
|
|
|
/// parent one. IF true and using a ConfigOptionsProvider, it will apply this
|
|
|
|
/// config on top of any configuation file it finds in the directory using the
|
|
|
|
/// same logic as FileOptionsProvider. If false or missing, only this
|
|
|
|
/// configuration file will be used.
|
2020-04-01 17:08:53 +08:00
|
|
|
llvm::Optional<bool> InheritParentConfig;
|
2020-06-18 23:12:36 +08:00
|
|
|
|
|
|
|
/// Use colors in diagnostics. If missing, it will be auto detected.
|
|
|
|
llvm::Optional<bool> UseColor;
|
2014-04-29 23:20:10 +08:00
|
|
|
};
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Abstract interface for retrieving various ClangTidy options.
|
2014-06-05 21:31:45 +08:00
|
|
|
class ClangTidyOptionsProvider {
|
|
|
|
public:
|
2016-04-27 17:15:01 +08:00
|
|
|
static const char OptionsSourceTypeDefaultBinary[];
|
|
|
|
static const char OptionsSourceTypeCheckCommandLineOption[];
|
|
|
|
static const char OptionsSourceTypeConfigCommandLineOption[];
|
|
|
|
|
2015-10-21 05:45:52 +08:00
|
|
|
virtual ~ClangTidyOptionsProvider() {}
|
2014-06-05 21:31:45 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Returns global options, which are independent of the file.
|
2014-06-05 21:31:45 +08:00
|
|
|
virtual const ClangTidyGlobalOptions &getGlobalOptions() = 0;
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// ClangTidyOptions and its source.
|
2016-04-27 17:15:01 +08:00
|
|
|
//
|
|
|
|
/// clang-tidy has 3 types of the sources in order of increasing priority:
|
|
|
|
/// * clang-tidy binary.
|
|
|
|
/// * '-config' commandline option or a specific configuration file. If the
|
|
|
|
/// commandline option is specified, clang-tidy will ignore the
|
|
|
|
/// configuration file.
|
|
|
|
/// * '-checks' commandline option.
|
|
|
|
typedef std::pair<ClangTidyOptions, std::string> OptionsSource;
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Returns an ordered vector of OptionsSources, in order of increasing
|
2016-04-27 17:15:01 +08:00
|
|
|
/// priority.
|
|
|
|
virtual std::vector<OptionsSource>
|
|
|
|
getRawOptions(llvm::StringRef FileName) = 0;
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Returns options applying to a specific translation unit with the
|
2014-06-05 21:31:45 +08:00
|
|
|
/// specified \p FileName.
|
2016-04-27 17:15:01 +08:00
|
|
|
ClangTidyOptions getOptions(llvm::StringRef FileName);
|
2014-06-05 21:31:45 +08:00
|
|
|
};
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Implementation of the \c ClangTidyOptionsProvider interface, which
|
2014-06-05 21:31:45 +08:00
|
|
|
/// returns the same options for all files.
|
|
|
|
class DefaultOptionsProvider : public ClangTidyOptionsProvider {
|
|
|
|
public:
|
|
|
|
DefaultOptionsProvider(const ClangTidyGlobalOptions &GlobalOptions,
|
|
|
|
const ClangTidyOptions &Options)
|
|
|
|
: GlobalOptions(GlobalOptions), DefaultOptions(Options) {}
|
|
|
|
const ClangTidyGlobalOptions &getGlobalOptions() override {
|
|
|
|
return GlobalOptions;
|
|
|
|
}
|
2016-04-27 17:15:01 +08:00
|
|
|
std::vector<OptionsSource> getRawOptions(llvm::StringRef FileName) override;
|
2014-06-05 21:31:45 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
ClangTidyGlobalOptions GlobalOptions;
|
|
|
|
ClangTidyOptions DefaultOptions;
|
|
|
|
};
|
|
|
|
|
2020-06-19 19:02:08 +08:00
|
|
|
class FileOptionsBaseProvider : public DefaultOptionsProvider {
|
2014-09-04 22:23:36 +08:00
|
|
|
public:
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
// A pair of configuration file base name and a function parsing
|
2014-10-20 20:29:15 +08:00
|
|
|
// configuration from text in the corresponding format.
|
|
|
|
typedef std::pair<std::string, std::function<llvm::ErrorOr<ClangTidyOptions>(
|
2016-11-08 15:50:19 +08:00
|
|
|
llvm::StringRef)>>
|
|
|
|
ConfigFileHandler;
|
2014-10-20 20:29:15 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Configuration file handlers listed in the order of priority.
|
2014-10-20 20:29:15 +08:00
|
|
|
///
|
|
|
|
/// Custom configuration file formats can be supported by constructing the
|
|
|
|
/// list of handlers and passing it to the appropriate \c FileOptionsProvider
|
|
|
|
/// constructor. E.g. initialization of a \c FileOptionsProvider with support
|
|
|
|
/// of a custom configuration file format for files named ".my-tidy-config"
|
|
|
|
/// could look similar to this:
|
|
|
|
/// \code
|
|
|
|
/// FileOptionsProvider::ConfigFileHandlers ConfigHandlers;
|
|
|
|
/// ConfigHandlers.emplace_back(".my-tidy-config", parseMyConfigFormat);
|
|
|
|
/// ConfigHandlers.emplace_back(".clang-tidy", parseConfiguration);
|
2019-08-15 07:52:23 +08:00
|
|
|
/// return std::make_unique<FileOptionsProvider>(
|
2014-10-20 20:29:15 +08:00
|
|
|
/// GlobalOptions, DefaultOptions, OverrideOptions, ConfigHandlers);
|
|
|
|
/// \endcode
|
|
|
|
///
|
|
|
|
/// With the order of handlers shown above, the ".my-tidy-config" file would
|
|
|
|
/// take precedence over ".clang-tidy" if both reside in the same directory.
|
|
|
|
typedef std::vector<ConfigFileHandler> ConfigFileHandlers;
|
|
|
|
|
2020-06-19 19:02:08 +08:00
|
|
|
FileOptionsBaseProvider(
|
|
|
|
const ClangTidyGlobalOptions &GlobalOptions,
|
|
|
|
const ClangTidyOptions &DefaultOptions,
|
|
|
|
const ClangTidyOptions &OverrideOptions,
|
|
|
|
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS = nullptr);
|
|
|
|
|
|
|
|
FileOptionsBaseProvider(const ClangTidyGlobalOptions &GlobalOptions,
|
|
|
|
const ClangTidyOptions &DefaultOptions,
|
|
|
|
const ClangTidyOptions &OverrideOptions,
|
|
|
|
const ConfigFileHandlers &ConfigHandlers);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void addRawFileOptions(llvm::StringRef AbsolutePath,
|
|
|
|
std::vector<OptionsSource> &CurOptions);
|
|
|
|
|
|
|
|
/// Try to read configuration files from \p Directory using registered
|
|
|
|
/// \c ConfigHandlers.
|
|
|
|
llvm::Optional<OptionsSource> tryReadConfigFile(llvm::StringRef Directory);
|
|
|
|
|
|
|
|
llvm::StringMap<OptionsSource> CachedOptions;
|
|
|
|
ClangTidyOptions OverrideOptions;
|
|
|
|
ConfigFileHandlers ConfigHandlers;
|
|
|
|
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Implementation of ClangTidyOptions interface, which is used for
|
|
|
|
/// '-config' command-line option.
|
|
|
|
class ConfigOptionsProvider : public FileOptionsBaseProvider {
|
|
|
|
public:
|
|
|
|
ConfigOptionsProvider(
|
|
|
|
const ClangTidyGlobalOptions &GlobalOptions,
|
|
|
|
const ClangTidyOptions &DefaultOptions,
|
|
|
|
const ClangTidyOptions &ConfigOptions,
|
|
|
|
const ClangTidyOptions &OverrideOptions,
|
|
|
|
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS = nullptr);
|
|
|
|
std::vector<OptionsSource> getRawOptions(llvm::StringRef FileName) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
ClangTidyOptions ConfigOptions;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Implementation of the \c ClangTidyOptionsProvider interface, which
|
|
|
|
/// tries to find a configuration file in the closest parent directory of each
|
|
|
|
/// source file.
|
|
|
|
///
|
|
|
|
/// By default, files named ".clang-tidy" will be considered, and the
|
|
|
|
/// \c clang::tidy::parseConfiguration function will be used for parsing, but a
|
|
|
|
/// custom set of configuration file names and parsing functions can be
|
|
|
|
/// specified using the appropriate constructor.
|
|
|
|
class FileOptionsProvider : public FileOptionsBaseProvider {
|
|
|
|
public:
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Initializes the \c FileOptionsProvider instance.
|
2014-09-04 22:23:36 +08:00
|
|
|
///
|
|
|
|
/// \param GlobalOptions are just stored and returned to the caller of
|
|
|
|
/// \c getGlobalOptions.
|
|
|
|
///
|
2014-09-25 02:36:03 +08:00
|
|
|
/// \param DefaultOptions are used for all settings not specified in a
|
2014-10-20 20:29:15 +08:00
|
|
|
/// configuration file.
|
2014-09-04 22:23:36 +08:00
|
|
|
///
|
|
|
|
/// If any of the \param OverrideOptions fields are set, they will override
|
|
|
|
/// whatever options are read from the configuration file.
|
2018-10-10 21:27:25 +08:00
|
|
|
FileOptionsProvider(
|
|
|
|
const ClangTidyGlobalOptions &GlobalOptions,
|
|
|
|
const ClangTidyOptions &DefaultOptions,
|
|
|
|
const ClangTidyOptions &OverrideOptions,
|
|
|
|
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS = nullptr);
|
2014-10-20 20:29:15 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Initializes the \c FileOptionsProvider instance with a custom set
|
2014-10-20 20:29:15 +08:00
|
|
|
/// of configuration file handlers.
|
|
|
|
///
|
|
|
|
/// \param GlobalOptions are just stored and returned to the caller of
|
|
|
|
/// \c getGlobalOptions.
|
|
|
|
///
|
|
|
|
/// \param DefaultOptions are used for all settings not specified in a
|
|
|
|
/// configuration file.
|
|
|
|
///
|
|
|
|
/// If any of the \param OverrideOptions fields are set, they will override
|
|
|
|
/// whatever options are read from the configuration file.
|
|
|
|
///
|
|
|
|
/// \param ConfigHandlers specifies a custom set of configuration file
|
|
|
|
/// handlers. Each handler is a pair of configuration file name and a function
|
|
|
|
/// that can parse configuration from this file type. The configuration files
|
|
|
|
/// in each directory are searched for in the order of appearance in
|
|
|
|
/// \p ConfigHandlers.
|
|
|
|
FileOptionsProvider(const ClangTidyGlobalOptions &GlobalOptions,
|
|
|
|
const ClangTidyOptions &DefaultOptions,
|
|
|
|
const ClangTidyOptions &OverrideOptions,
|
|
|
|
const ConfigFileHandlers &ConfigHandlers);
|
|
|
|
|
2016-04-27 17:15:01 +08:00
|
|
|
std::vector<OptionsSource> getRawOptions(llvm::StringRef FileName) override;
|
2014-09-04 22:23:36 +08:00
|
|
|
};
|
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Parses LineFilter from JSON and stores it to the \p Options.
|
2014-09-04 22:23:36 +08:00
|
|
|
std::error_code parseLineFilter(llvm::StringRef LineFilter,
|
|
|
|
ClangTidyGlobalOptions &Options);
|
2014-06-05 21:31:45 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Parses configuration from JSON and returns \c ClangTidyOptions or an
|
2014-09-25 02:36:03 +08:00
|
|
|
/// error.
|
|
|
|
llvm::ErrorOr<ClangTidyOptions> parseConfiguration(llvm::StringRef Config);
|
2014-09-04 22:23:36 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Serializes configuration to a YAML-encoded string.
|
2014-09-04 22:23:36 +08:00
|
|
|
std::string configurationAsText(const ClangTidyOptions &Options);
|
2014-05-23 00:07:11 +08:00
|
|
|
|
2014-04-29 23:20:10 +08:00
|
|
|
} // end namespace tidy
|
|
|
|
} // end namespace clang
|
|
|
|
|
2015-03-10 00:52:33 +08:00
|
|
|
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYOPTIONS_H
|