OverloadedUnaryAndCheck.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //===--- OverloadedUnaryAndCheck.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_GOOGLE_OVERLOADEDUNARYANDCHECK_H
  9. #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_OVERLOADEDUNARYANDCHECK_H
  10. #include "../ClangTidyCheck.h"
  11. namespace clang::tidy::google::runtime {
  12. /// Finds overloads of unary `operator &`.
  13. ///
  14. /// https://google.github.io/styleguide/cppguide.html#Operator_Overloading
  15. ///
  16. /// Corresponding cpplint.py check name: 'runtime/operator'.
  17. ///
  18. /// For the user-facing documentation see:
  19. /// http://clang.llvm.org/extra/clang-tidy/checks/google/runtime-operator.html
  20. class OverloadedUnaryAndCheck : public ClangTidyCheck {
  21. public:
  22. OverloadedUnaryAndCheck(StringRef Name, ClangTidyContext *Context)
  23. : ClangTidyCheck(Name, Context) {}
  24. bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
  25. return LangOpts.CPlusPlus;
  26. }
  27. void registerMatchers(ast_matchers::MatchFinder *Finder) override;
  28. void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
  29. };
  30. } // namespace clang::tidy::google::runtime
  31. #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_OVERLOADEDUNARYANDCHECK_H