diff options
| author | Haojian Wu <hokein@google.com> | 2016-02-05 11:23:59 +0000 |
|---|---|---|
| committer | Haojian Wu <hokein@google.com> | 2016-02-05 11:23:59 +0000 |
| commit | c2d7577cc552b248857253f99a401800bc010100 (patch) | |
| tree | 1146fd04b4d6781a76196f3e3aacad3006722396 /clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h | |
| parent | 5990cd5a0c8fde4baceea0734ae9e086e987f577 (diff) | |
| download | bcm5719-llvm-c2d7577cc552b248857253f99a401800bc010100.tar.gz bcm5719-llvm-c2d7577cc552b248857253f99a401800bc010100.zip | |
[clang-tdiy] Add header file extension configuration support.
Summary: * Add a `HeaderFileExtensions` check option in misc-definitions-in-headers, google-build-namespaces and google-global-names-in-headers.
Reviewers: aaron.ballman, alexfh
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D16113
llvm-svn: 259879
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h')
| -rw-r--r-- | clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h b/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h index 93956099b1b..428b05cd5ac 100644 --- a/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h +++ b/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h @@ -11,20 +11,26 @@ #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_DEFINITIONS_IN_HEADERS_H #include "../ClangTidy.h" +#include "../utils/HeaderFileExtensionsUtils.h" namespace clang { namespace tidy { namespace misc { -// Finds non-extern non-inline function and variable definitions in header -// files, which can lead to potential ODR violations. -// -// There is one option: -// - `UseHeaderFileExtension`: Whether to use file extension (h, hh, hpp, hxx) -// to distinguish header files. True by default. -// -// For the user-facing documentation see: -// http://clang.llvm.org/extra/clang-tidy/checks/misc-definitions-in-headers.html +/// Finds non-extern non-inline function and variable definitions in header +/// files, which can lead to potential ODR violations. +/// +/// The check supports these options: +/// - `UseHeaderFileExtension`: Whether to use file extension to distinguish +/// header files. True by default. +/// - `HeaderFileExtensions`: a comma-separated list of filename extensions of +/// header files (The filename extension should not contain "." prefix). +/// ",h,hh,hpp,hxx" by default. +/// For extension-less header files, using an empty string or leaving an +/// empty string between "," if there are other filename extensions. +/// +/// For the user-facing documentation see: +/// http://clang.llvm.org/extra/clang-tidy/checks/misc-definitions-in-headers.html class DefinitionsInHeadersCheck : public ClangTidyCheck { public: DefinitionsInHeadersCheck(StringRef Name, ClangTidyContext *Context); @@ -34,6 +40,8 @@ public: private: const bool UseHeaderFileExtension; + const std::string RawStringHeaderFileExtensions; + utils::HeaderFileExtensionsSet HeaderFileExtensions; }; } // namespace misc |

