2014-07-16 22:16:56 +08:00
|
|
|
//===--- UnnamedNamespaceInHeaderCheck.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-07-16 22:16:56 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-03-10 00:52:33 +08:00
|
|
|
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_UNNAMEDNAMESPACEINHEADERCHECK_H
|
|
|
|
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_UNNAMEDNAMESPACEINHEADERCHECK_H
|
2014-07-16 22:16:56 +08:00
|
|
|
|
2019-03-25 20:38:26 +08:00
|
|
|
#include "../ClangTidyCheck.h"
|
2020-02-26 01:41:32 +08:00
|
|
|
#include "../utils/FileExtensionsUtils.h"
|
2014-07-16 22:16:56 +08:00
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
2015-03-05 21:46:14 +08:00
|
|
|
namespace google {
|
2014-07-16 22:16:56 +08:00
|
|
|
namespace build {
|
|
|
|
|
2015-08-28 02:01:58 +08:00
|
|
|
/// Finds anonymous namespaces in headers.
|
2014-07-16 22:16:56 +08:00
|
|
|
///
|
2016-02-05 19:23:59 +08:00
|
|
|
/// The check supports these options:
|
2020-03-05 00:55:03 +08:00
|
|
|
/// - `HeaderFileExtensions`: a semicolon-separated list of filename
|
|
|
|
/// extensions of header files (The filename extensions should not contain
|
|
|
|
/// "." prefix). ";h;hh;hpp;hxx" by default.
|
|
|
|
///
|
2016-02-05 19:23:59 +08:00
|
|
|
/// For extension-less header files, using an empty string or leaving an
|
2020-03-05 00:55:03 +08:00
|
|
|
/// empty string between ";" if there are other filename extensions.
|
2016-02-05 19:23:59 +08:00
|
|
|
///
|
2016-02-25 22:31:10 +08:00
|
|
|
/// https://google.github.io/styleguide/cppguide.html#Namespaces
|
2015-08-28 02:01:58 +08:00
|
|
|
///
|
2014-07-16 22:16:56 +08:00
|
|
|
/// Corresponding cpplint.py check name: 'build/namespaces'.
|
|
|
|
class UnnamedNamespaceInHeaderCheck : public ClangTidyCheck {
|
|
|
|
public:
|
2016-02-05 19:23:59 +08:00
|
|
|
UnnamedNamespaceInHeaderCheck(StringRef Name, ClangTidyContext *Context);
|
[clang-tidy] Change checks to use new isLanguageVersionSupported restriction
Summary: Modifies all checks that are language version dependent to use `isLanguageVersionSupported`
Reviewers: jdoerfert, lebedev.ri, aaron.ballman, gribozavr2, Eugene.Zelenko
Reviewed By: gribozavr2
Subscribers: wuzish, nemanjai, xazax.hun, hiraditya, kbarton, steven_wu, dexonsmith, arphaman, lebedev.ri, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75340
2020-03-04 00:39:32 +08:00
|
|
|
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
|
|
|
|
return LangOpts.CPlusPlus;
|
|
|
|
}
|
2016-02-05 19:23:59 +08:00
|
|
|
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
2014-07-16 22:16:56 +08:00
|
|
|
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
|
|
|
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
2016-02-05 19:23:59 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
const std::string RawStringHeaderFileExtensions;
|
2020-02-26 01:41:32 +08:00
|
|
|
utils::FileExtensionsSet HeaderFileExtensions;
|
2014-07-16 22:16:56 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace build
|
2015-03-05 21:46:14 +08:00
|
|
|
} // namespace google
|
2014-07-16 22:16:56 +08:00
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|
|
|
|
|
2015-03-10 00:52:33 +08:00
|
|
|
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_UNNAMEDNAMESPACEINHEADERCHECK_H
|