CleanupCtadCheck.h 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. //===--- CleanupCtadCheck.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_ABSEIL_CLEANUPCTADCHECK_H
  9. #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_CLEANUPCTADCHECK_H
  10. #include "../utils/TransformerClangTidyCheck.h"
  11. namespace clang::tidy::abseil {
  12. /// Suggests switching the initialization pattern of `absl::Cleanup`
  13. /// instances from the factory function to class template argument
  14. /// deduction (CTAD), in C++17 and higher.
  15. ///
  16. /// For the user-facing documentation see:
  17. /// http://clang.llvm.org/extra/clang-tidy/checks/abseil/cleanup-ctad.html
  18. class CleanupCtadCheck : public utils::TransformerClangTidyCheck {
  19. public:
  20. CleanupCtadCheck(StringRef Name, ClangTidyContext *Context);
  21. bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
  22. return LangOpts.CPlusPlus17;
  23. }
  24. };
  25. } // namespace clang::tidy::abseil
  26. #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_CLEANUPCTADCHECK_H