ExplicitMakePairCheck.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //===--- ExplicitMakePairCheck.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_GOOGLE_EXPLICITMAKEPAIRCHECK_H
  9. #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_EXPLICITMAKEPAIRCHECK_H
  10. #include "../ClangTidyCheck.h"
  11. namespace clang::tidy::google::build {
  12. /// Check that `make_pair`'s template arguments are deduced.
  13. ///
  14. /// G++ 4.6 in C++11 mode fails badly if `make_pair`'s template arguments are
  15. /// specified explicitly, and such use isn't intended in any case.
  16. ///
  17. /// Corresponding cpplint.py check name: 'build/explicit_make_pair'.
  18. ///
  19. /// For the user-facing documentation see:
  20. /// http://clang.llvm.org/extra/clang-tidy/checks/google/build-explicit-make-pair.html
  21. class ExplicitMakePairCheck : public ClangTidyCheck {
  22. public:
  23. ExplicitMakePairCheck(StringRef Name, ClangTidyContext *Context)
  24. : ClangTidyCheck(Name, Context) {}
  25. bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
  26. return LangOpts.CPlusPlus;
  27. }
  28. void registerMatchers(ast_matchers::MatchFinder *Finder) override;
  29. void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
  30. };
  31. } // namespace clang::tidy::google::build
  32. #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_EXPLICITMAKEPAIRCHECK_H