//===--- FoldInitTypeCheck.cpp - clang-tidy--------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "FoldInitTypeCheck.h" #include "clang/AST/ASTContext.h" #include "clang/ASTMatchers/ASTMatchFinder.h" usingnamespaceclang::ast_matchers; namespace clang::tidy::bugprone { void FoldInitTypeCheck::registerMatchers(MatchFinder *Finder) { … } /// Returns true if ValueType is allowed to fold into InitType, i.e. if: /// static_cast<InitType>(ValueType{some_value}) /// does not result in trucation. static bool isValidBuiltinFold(const BuiltinType &ValueType, const BuiltinType &InitType, const ASTContext &Context) { … } /// Prints a diagnostic if IterValueType doe snot fold into IterValueType (see // isValidBuiltinFold for details). void FoldInitTypeCheck::doCheck(const BuiltinType &IterValueType, const BuiltinType &InitType, const ASTContext &Context, const CallExpr &CallNode) { … } void FoldInitTypeCheck::check(const MatchFinder::MatchResult &Result) { … } } // namespace clang::tidy::bugprone