UseUsingCheck.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //===--- UseUsingCheck.h - clang-tidy----------------------------*- C++ -*-===//
  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. #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_USING_H
  9. #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_USING_H
  10. #include "../ClangTidyCheck.h"
  11. namespace clang::tidy::modernize {
  12. /// Check finds typedefs and replaces it with usings.
  13. ///
  14. /// For the user-facing documentation see:
  15. /// http://clang.llvm.org/extra/clang-tidy/checks/modernize/use-using.html
  16. class UseUsingCheck : public ClangTidyCheck {
  17. const bool IgnoreMacros;
  18. SourceLocation LastReplacementEnd;
  19. llvm::DenseMap<const Decl *, SourceRange> LastTagDeclRanges;
  20. std::string FirstTypedefType;
  21. std::string FirstTypedefName;
  22. public:
  23. UseUsingCheck(StringRef Name, ClangTidyContext *Context);
  24. bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
  25. return LangOpts.CPlusPlus11;
  26. }
  27. void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
  28. void registerMatchers(ast_matchers::MatchFinder *Finder) override;
  29. void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
  30. };
  31. } // namespace clang::tidy::modernize
  32. #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_USING_H