2015-02-12 05:21:05 +08:00
|
|
|
//===--- GlobalNamesInHeadersCheck.h - clang-tidy ---------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-03-10 00:52:33 +08:00
|
|
|
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_GLOBALNAMESINHEADERSCHECK_H
|
|
|
|
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_GLOBALNAMESINHEADERSCHECK_H
|
2015-02-12 05:21:05 +08:00
|
|
|
|
|
|
|
#include "../ClangTidy.h"
|
2016-02-05 19:23:59 +08:00
|
|
|
#include "../utils/HeaderFileExtensionsUtils.h"
|
2015-02-12 05:21:05 +08:00
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
2015-03-05 21:46:14 +08:00
|
|
|
namespace google {
|
2015-02-12 05:21:05 +08:00
|
|
|
namespace readability {
|
|
|
|
|
2016-02-05 19:23:59 +08:00
|
|
|
/// Flag global namespace pollution in header files.
|
|
|
|
/// Right now it only triggers on using declarations and directives.
|
|
|
|
///
|
|
|
|
/// The check supports these options:
|
|
|
|
/// - `HeaderFileExtensions`: a comma-separated list of filename extensions
|
|
|
|
/// of header files (The filename extensions should not contain "." prefix).
|
|
|
|
/// "h" by default.
|
|
|
|
/// For extension-less header files, using an empty string or leaving an
|
|
|
|
/// empty string between "," if there are other filename extensions.
|
2015-02-12 05:21:05 +08:00
|
|
|
class GlobalNamesInHeadersCheck : public ClangTidyCheck {
|
|
|
|
public:
|
2016-02-05 19:23:59 +08:00
|
|
|
GlobalNamesInHeadersCheck(StringRef Name, ClangTidyContext *Context);
|
|
|
|
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
2015-02-12 05:21:05 +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;
|
|
|
|
utils::HeaderFileExtensionsSet HeaderFileExtensions;
|
2015-02-12 05:21:05 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace readability
|
2015-03-05 21:46:14 +08:00
|
|
|
} // namespace google
|
2015-02-12 05:21:05 +08:00
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|
|
|
|
|
2015-03-10 00:52:33 +08:00
|
|
|
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_GLOBALNAMESINHEADERSCHECK_H
|