clang-tools 22.0.0git
clang::tidy::google::build::UsingNamespaceDirectiveCheck Class Reference

Finds using namespace directives. More...

#include <UsingNamespaceDirectiveCheck.h>

Inheritance diagram for clang::tidy::google::build::UsingNamespaceDirectiveCheck:
[legend]

Public Member Functions

 UsingNamespaceDirectiveCheck (StringRef Name, ClangTidyContext *Context)
bool isLanguageVersionSupported (const LangOptions &LangOpts) const override
void registerMatchers (ast_matchers::MatchFinder *Finder) override
void check (const ast_matchers::MatchFinder::MatchResult &Result) override

Detailed Description

Finds using namespace directives.

https://google.github.io/styleguide/cppguide.html#Namespaces

The check implements the following rule of the Google C++ Style Guide:

You may not use a using-directive to make all names from a namespace available.

// Forbidden -- This pollutes the namespace.
using namespace foo;
int foo()
Definition foo.cpp:2

Corresponding cpplint.py check name: build/namespaces.

For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/google/build-using-namespace.html

Definition at line 34 of file UsingNamespaceDirectiveCheck.h.

Constructor & Destructor Documentation

◆ UsingNamespaceDirectiveCheck()

clang::tidy::google::build::UsingNamespaceDirectiveCheck::UsingNamespaceDirectiveCheck ( StringRef Name,
ClangTidyContext * Context )
inline

Definition at line 36 of file UsingNamespaceDirectiveCheck.h.

Member Function Documentation

◆ check()

void clang::tidy::google::build::UsingNamespaceDirectiveCheck::check ( const ast_matchers::MatchFinder::MatchResult & Result)
override

Definition at line 22 of file UsingNamespaceDirectiveCheck.cpp.

◆ isLanguageVersionSupported()

bool clang::tidy::google::build::UsingNamespaceDirectiveCheck::isLanguageVersionSupported ( const LangOptions & LangOpts) const
inlineoverride

Definition at line 38 of file UsingNamespaceDirectiveCheck.h.

◆ registerMatchers()

void clang::tidy::google::build::UsingNamespaceDirectiveCheck::registerMatchers ( ast_matchers::MatchFinder * Finder)
override

Definition at line 17 of file UsingNamespaceDirectiveCheck.cpp.


The documentation for this class was generated from the following files: