#include "ImplicitBoolConversionCheck.h"
#include "../utils/FixItHintUtils.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"
#include "clang/Tooling/FixIt.h"
#include <queue>
usingnamespaceclang::ast_matchers;
namespace clang::tidy::readability {
namespace {
AST_MATCHER(Stmt, isMacroExpansion) { … }
bool isNULLMacroExpansion(const Stmt *Statement, ASTContext &Context) { … }
AST_MATCHER(Stmt, isNULLMacroExpansion) { … }
StringRef getZeroLiteralToCompareWithForType(CastKind CastExprKind,
QualType Type,
ASTContext &Context) { … }
bool isUnaryLogicalNotOperator(const Stmt *Statement) { … }
void fixGenericExprCastToBool(DiagnosticBuilder &Diag,
const ImplicitCastExpr *Cast, const Stmt *Parent,
ASTContext &Context,
bool UseUpperCaseLiteralSuffix) { … }
StringRef getEquivalentBoolLiteralForExpr(const Expr *Expression,
ASTContext &Context) { … }
bool needsSpacePrefix(SourceLocation Loc, ASTContext &Context) { … }
void fixGenericExprCastFromBool(DiagnosticBuilder &Diag,
const ImplicitCastExpr *Cast,
ASTContext &Context, StringRef OtherType) { … }
StringRef getEquivalentForBoolLiteral(const CXXBoolLiteralExpr *BoolLiteral,
QualType DestType, ASTContext &Context) { … }
bool isCastAllowedInCondition(const ImplicitCastExpr *Cast,
ASTContext &Context) { … }
}
ImplicitBoolConversionCheck::ImplicitBoolConversionCheck(
StringRef Name, ClangTidyContext *Context)
: … { … }
void ImplicitBoolConversionCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) { … }
void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) { … }
void ImplicitBoolConversionCheck::check(
const MatchFinder::MatchResult &Result) { … }
void ImplicitBoolConversionCheck::handleCastToBool(const ImplicitCastExpr *Cast,
const Stmt *Parent,
ASTContext &Context) { … }
void ImplicitBoolConversionCheck::handleCastFromBool(
const ImplicitCastExpr *Cast, const ImplicitCastExpr *NextImplicitCast,
ASTContext &Context) { … }
}