clang-tools 6.0.0

UnusedAliasDeclsCheck.h
Go to the documentation of this file.
1 //===--- UnusedAliasDeclsCheck.h - clang-tidy--------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_ALIAS_DECLS_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_ALIAS_DECLS_H
12
13 #include "../ClangTidy.h"
14 #include "llvm/ADT/DenseMap.h"
15
16 namespace clang {
17 namespace tidy {
18 namespace misc {
19
20 /// Finds unused namespace alias declarations.
21 class UnusedAliasDeclsCheck : public ClangTidyCheck {
22 public:
23 UnusedAliasDeclsCheck(StringRef Name, ClangTidyContext *Context)
24 : ClangTidyCheck(Name, Context) {}
25 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
26 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
27 void onEndOfTranslationUnit() override;
28
29 private:
30 llvm::DenseMap<const NamedDecl *, CharSourceRange> FoundDecls;
31 };
32
33 } // namespace misc
34 } // namespace tidy
35 } // namespace clang
36
37 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_ALIAS_DECLS_H
clang::tidy::misc::UnusedAliasDeclsCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Definition: UnusedAliasDeclsCheck.cpp:21
clang::tidy::misc::UnusedAliasDeclsCheck::UnusedAliasDeclsCheck
UnusedAliasDeclsCheck(StringRef Name, ClangTidyContext *Context)
Definition: UnusedAliasDeclsCheck.h:23
Name
StringHandle Name
Definition: PreprocessorTracker.cpp:525
clang::tidy::misc::UnusedAliasDeclsCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition: UnusedAliasDeclsCheck.cpp:34
clang::tidy::misc::UnusedAliasDeclsCheck
Finds unused namespace alias declarations.
Definition: UnusedAliasDeclsCheck.h:21
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
clang::tidy::misc::UnusedAliasDeclsCheck::onEndOfTranslationUnit
void onEndOfTranslationUnit() override
Definition: UnusedAliasDeclsCheck.cpp:53
clang
Definition: AndroidTidyModule.cpp:28
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:104