NoAutomaticMoveCheck.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. //===--- NoAutomaticMoveCheck.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_PERFORMANCE_NOAUTOMATICMOVECHECK_H
  9. #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_NOAUTOMATICMOVECHECK_H
  10. #include "../ClangTidyCheck.h"
  11. namespace clang::tidy::performance {
  12. /// Finds local variables that cannot be automatically moved due to constness.
  13. /// For the user-facing documentation see:
  14. /// http://clang.llvm.org/extra/clang-tidy/checks/performance/no-automatic-move.html
  15. class NoAutomaticMoveCheck : public ClangTidyCheck {
  16. public:
  17. NoAutomaticMoveCheck(StringRef Name, ClangTidyContext *Context);
  18. bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
  19. return LangOpts.CPlusPlus11;
  20. }
  21. void registerMatchers(ast_matchers::MatchFinder *Finder) override;
  22. void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
  23. void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
  24. private:
  25. const std::vector<StringRef> AllowedTypes;
  26. };
  27. } // namespace clang::tidy::performance
  28. #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_NOAUTOMATICMOVECHECK_H