AssertEquals.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. //===--- AssertEquals.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 THIRD_PARTY_LLVM_LLVM_PROJECT_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_OBJCASSERTEQUALS_H_
  9. #define THIRD_PARTY_LLVM_LLVM_PROJECT_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_OBJCASSERTEQUALS_H_
  10. #include "../ClangTidyCheck.h"
  11. #include "clang/ASTMatchers/ASTMatchFinder.h"
  12. namespace clang::tidy::objc {
  13. /// Warn if XCTAssertEqual() or XCTAssertNotEqual() is used with at least one
  14. /// operands of type NSString*.
  15. ///
  16. /// For the user-facing documentation see:
  17. /// http://clang.llvm.org/extra/clang-tidy/checks/objc/assert-equals.html
  18. class AssertEquals final : public ClangTidyCheck {
  19. public:
  20. AssertEquals(StringRef Name, ClangTidyContext *Context)
  21. : ClangTidyCheck(Name, Context) {}
  22. bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
  23. return LangOpts.ObjC;
  24. }
  25. void registerMatchers(ast_matchers::MatchFinder *Finder) override;
  26. void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
  27. };
  28. } // namespace clang::tidy::objc
  29. #endif // THIRD_PARTY_LLVM_LLVM_PROJECT_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_OBJCASSERTEQUALS_H_