TwineLocalCheck.h 1.1 KB

12345678910111213141516171819202122232425262728
  1. //===--- TwineLocalCheck.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_LLVM_TWINELOCALCHECK_H
  9. #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_TWINELOCALCHECK_H
  10. #include "../ClangTidyCheck.h"
  11. namespace clang::tidy::llvm_check {
  12. /// Looks for local `Twine` variables which are prone to use after frees and
  13. /// should be generally avoided.
  14. class TwineLocalCheck : public ClangTidyCheck {
  15. public:
  16. TwineLocalCheck(StringRef Name, ClangTidyContext *Context)
  17. : ClangTidyCheck(Name, Context) {}
  18. void registerMatchers(ast_matchers::MatchFinder *Finder) override;
  19. void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
  20. };
  21. } // namespace clang::tidy::llvm_check
  22. #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_TWINELOCALCHECK_H