CloexecFopenCheck.h 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. //===--- CloexecFopenCheck.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_ANDROID_CLOEXEC_FOPEN_H
  9. #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ANDROID_CLOEXEC_FOPEN_H
  10. #include "CloexecCheck.h"
  11. namespace clang::tidy::android {
  12. /// fopen() is suggested to include "e" in their mode string; like "re" would be
  13. /// better than "r".
  14. ///
  15. /// This check only works when corresponding argument is StringLiteral. No
  16. /// constant propagation.
  17. ///
  18. /// http://clang.llvm.org/extra/clang-tidy/checks/android/cloexec-fopen.html
  19. class CloexecFopenCheck : public CloexecCheck {
  20. public:
  21. CloexecFopenCheck(StringRef Name, ClangTidyContext *Context)
  22. : CloexecCheck(Name, Context) {}
  23. void registerMatchers(ast_matchers::MatchFinder *Finder) override;
  24. void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
  25. };
  26. } // namespace clang::tidy::android
  27. #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ANDROID_CLOEXEC_FOPEN_H