blob: f25e8d8db05092b5f9cbe73a141eeb98548a709e [file] [log] [blame]
Daniel Jasperbb42b032015-07-31 16:08:10 +00001//===--- UnusedAliasDeclsCheck.h - clang-tidy--------------------*- C++ -*-===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Daniel Jasperbb42b032015-07-31 16:08:10 +00006//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_ALIAS_DECLS_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_ALIAS_DECLS_H
11
Alexander Kornienko478fc5c2019-03-25 12:38:26 +000012#include "../ClangTidyCheck.h"
Daniel Jasper727fd1a2016-04-19 13:48:39 +000013#include "llvm/ADT/DenseMap.h"
Daniel Jasperbb42b032015-07-31 16:08:10 +000014
15namespace clang {
16namespace tidy {
Kirill Bobyrev11cea452016-08-01 12:06:18 +000017namespace misc {
Daniel Jasperbb42b032015-07-31 16:08:10 +000018
Alexander Kornienkof8ed0a82015-08-27 18:01:58 +000019/// Finds unused namespace alias declarations.
Daniel Jasperbb42b032015-07-31 16:08:10 +000020class UnusedAliasDeclsCheck : public ClangTidyCheck {
21public:
22 UnusedAliasDeclsCheck(StringRef Name, ClangTidyContext *Context)
23 : ClangTidyCheck(Name, Context) {}
24 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
25 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Daniel Jasper0aeed7c2015-07-31 18:32:38 +000026 void onEndOfTranslationUnit() override;
Daniel Jasperbb42b032015-07-31 16:08:10 +000027
28private:
Alexander Kornienko2644cae2015-08-03 22:02:08 +000029 llvm::DenseMap<const NamedDecl *, CharSourceRange> FoundDecls;
Daniel Jasperbb42b032015-07-31 16:08:10 +000030};
31
Etienne Bergeron456177b2016-05-02 18:00:29 +000032} // namespace misc
Daniel Jasperbb42b032015-07-31 16:08:10 +000033} // namespace tidy
34} // namespace clang
35
36#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSED_ALIAS_DECLS_H