1*1ad1f981SPiotr Zegar //===--- RedundantCastingCheck.h - clang-tidy -------------------*- C++ -*-===// 2*1ad1f981SPiotr Zegar // 3*1ad1f981SPiotr Zegar // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*1ad1f981SPiotr Zegar // See https://llvm.org/LICENSE.txt for license information. 5*1ad1f981SPiotr Zegar // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*1ad1f981SPiotr Zegar // 7*1ad1f981SPiotr Zegar //===----------------------------------------------------------------------===// 8*1ad1f981SPiotr Zegar 9*1ad1f981SPiotr Zegar #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_REDUNDANTCASTINGCHECK_H 10*1ad1f981SPiotr Zegar #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_REDUNDANTCASTINGCHECK_H 11*1ad1f981SPiotr Zegar 12*1ad1f981SPiotr Zegar #include "../ClangTidyCheck.h" 13*1ad1f981SPiotr Zegar 14*1ad1f981SPiotr Zegar namespace clang::tidy::readability { 15*1ad1f981SPiotr Zegar 16*1ad1f981SPiotr Zegar /// Detects explicit type casting operations that involve the same source and 17*1ad1f981SPiotr Zegar /// destination types, and subsequently recommend their removal. 18*1ad1f981SPiotr Zegar /// 19*1ad1f981SPiotr Zegar /// For the user-facing documentation see: 20*1ad1f981SPiotr Zegar /// http://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-casting.html 21*1ad1f981SPiotr Zegar class RedundantCastingCheck : public ClangTidyCheck { 22*1ad1f981SPiotr Zegar public: 23*1ad1f981SPiotr Zegar RedundantCastingCheck(StringRef Name, ClangTidyContext *Context); 24*1ad1f981SPiotr Zegar void registerMatchers(ast_matchers::MatchFinder *Finder) override; 25*1ad1f981SPiotr Zegar void check(const ast_matchers::MatchFinder::MatchResult &Result) override; 26*1ad1f981SPiotr Zegar void storeOptions(ClangTidyOptions::OptionMap &Opts) override; getCheckTraversalKind()27*1ad1f981SPiotr Zegar std::optional<TraversalKind> getCheckTraversalKind() const override { 28*1ad1f981SPiotr Zegar return TK_IgnoreUnlessSpelledInSource; 29*1ad1f981SPiotr Zegar } 30*1ad1f981SPiotr Zegar 31*1ad1f981SPiotr Zegar private: 32*1ad1f981SPiotr Zegar const bool IgnoreMacros; 33*1ad1f981SPiotr Zegar const bool IgnoreTypeAliases; 34*1ad1f981SPiotr Zegar }; 35*1ad1f981SPiotr Zegar 36*1ad1f981SPiotr Zegar } // namespace clang::tidy::readability 37*1ad1f981SPiotr Zegar 38*1ad1f981SPiotr Zegar #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_REDUNDANTCASTINGCHECK_H 39