clang-tools
22.0.0git
llvm-project
clang-tools-extra
clang-tidy
misc
AnonymousNamespaceInHeaderCheck.h
Go to the documentation of this file.
1
//===----------------------------------------------------------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ANONYMOUSNAMESPACEINHEADERCHECK_H
10
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ANONYMOUSNAMESPACEINHEADERCHECK_H
11
12
#include "
../ClangTidyCheck.h
"
13
14
namespace
clang::tidy::misc
{
15
16
/// Finds anonymous namespaces in headers.
17
///
18
/// https://google.github.io/styleguide/cppguide.html#Namespaces
19
///
20
/// Corresponding cpplint.py check name: 'build/namespaces'.
21
///
22
/// For the user-facing documentation see:
23
/// https://clang.llvm.org/extra/clang-tidy/checks/misc/anonymous-namespace-in-header.html
24
class
AnonymousNamespaceInHeaderCheck
:
public
ClangTidyCheck
{
25
public
:
26
AnonymousNamespaceInHeaderCheck
(StringRef Name,
ClangTidyContext
*Context);
27
bool
isLanguageVersionSupported
(
const
LangOptions &LangOpts)
const override
{
28
return
LangOpts.CPlusPlus;
29
}
30
void
registerMatchers
(ast_matchers::MatchFinder *Finder)
override
;
31
void
check
(
const
ast_matchers::MatchFinder::MatchResult &Result)
override
;
32
33
private
:
34
FileExtensionsSet
HeaderFileExtensions;
35
};
36
37
}
// namespace clang::tidy::misc
38
39
#endif
// LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ANONYMOUSNAMESPACEINHEADERCHECK_H
ClangTidyCheck.h
ClangTidyCheck
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition
ClangTidyDiagnosticConsumer.h:70
clang::tidy::misc::AnonymousNamespaceInHeaderCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Definition
AnonymousNamespaceInHeaderCheck.cpp:23
clang::tidy::misc::AnonymousNamespaceInHeaderCheck::AnonymousNamespaceInHeaderCheck
AnonymousNamespaceInHeaderCheck(StringRef Name, ClangTidyContext *Context)
Definition
AnonymousNamespaceInHeaderCheck.cpp:18
clang::tidy::misc::AnonymousNamespaceInHeaderCheck::isLanguageVersionSupported
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
Definition
AnonymousNamespaceInHeaderCheck.h:27
clang::tidy::misc::AnonymousNamespaceInHeaderCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
Definition
AnonymousNamespaceInHeaderCheck.cpp:29
clang::tidy::misc
Definition
AnonymousNamespaceInHeaderCheck.cpp:16
clang::tidy::FileExtensionsSet
llvm::SmallSet< llvm::StringRef, 5 > FileExtensionsSet
Definition
FileExtensionsSet.h:16
Generated on
for clang-tools by
1.14.0