blob: b95d75e98b3af6dfc9bd94b4ce88a46f161bb08f [file] [log] [blame]
//===--- ImplicitConversionInLoopCheck.h - clang-tidy------------*- C++ -*-===//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "../ClangTidyCheck.h"
namespace clang {
namespace tidy {
namespace performance {
// Checks that in a for range loop, if the provided type is a reference, then
// the underlying type is the one returned by the iterator (i.e. that there
// isn't any implicit conversion).
class ImplicitConversionInLoopCheck : public ClangTidyCheck {
ImplicitConversionInLoopCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override{
return LangOpts.CPlusPlus11;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
void reportAndFix(const ASTContext *Context, const VarDecl *VD,
const Expr *OperatorCall);
} // namespace performance
} // namespace tidy
} // namespace clang