1618c0bc3SJonas Toth //===--- DurationFactoryFloatCheck.h - clang-tidy ---------------*- C++ -*-===// 2618c0bc3SJonas Toth // 32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6618c0bc3SJonas Toth // 7618c0bc3SJonas Toth //===----------------------------------------------------------------------===// 8618c0bc3SJonas Toth 9618c0bc3SJonas Toth #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONFACTORYFLOATCHECK_H 10618c0bc3SJonas Toth #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONFACTORYFLOATCHECK_H 11618c0bc3SJonas Toth 12860aefd0SNathan James #include "../ClangTidyCheck.h" 13618c0bc3SJonas Toth 14*4718da50SCarlos Galvez namespace clang::tidy::abseil { 15618c0bc3SJonas Toth 16618c0bc3SJonas Toth /// This check finds cases where `Duration` factories are being called with 17618c0bc3SJonas Toth /// floating point arguments, but could be called using integer arguments. 18618c0bc3SJonas Toth /// It handles explicit casts and floating point literals with no fractional 19618c0bc3SJonas Toth /// component. 20618c0bc3SJonas Toth /// 21618c0bc3SJonas Toth /// For the user-facing documentation see: 226e566bc5SRichard /// http://clang.llvm.org/extra/clang-tidy/checks/abseil/duration-factory-float.html 23618c0bc3SJonas Toth class DurationFactoryFloatCheck : public ClangTidyCheck { 24618c0bc3SJonas Toth public: DurationFactoryFloatCheck(StringRef Name,ClangTidyContext * Context)25618c0bc3SJonas Toth DurationFactoryFloatCheck(StringRef Name, ClangTidyContext *Context) 26618c0bc3SJonas Toth : ClangTidyCheck(Name, Context) {} 27618c0bc3SJonas Toth void registerMatchers(ast_matchers::MatchFinder *Finder) override; 28618c0bc3SJonas Toth void check(const ast_matchers::MatchFinder::MatchResult &Result) override; 29618c0bc3SJonas Toth }; 30618c0bc3SJonas Toth 31*4718da50SCarlos Galvez } // namespace clang::tidy::abseil 32618c0bc3SJonas Toth 33618c0bc3SJonas Toth #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_DURATIONFACTORYFLOATCHECK_H 34