#include "SuspiciousEnumUsageCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include <algorithm>
usingnamespaceclang::ast_matchers;
namespace clang::tidy::bugprone {
static const char DifferentEnumErrorMessage[] = …;
static const char BitmaskErrorMessage[] = …;
static const char BitmaskVarErrorMessage[] = …;
static const char BitmaskNoteMessage[] = …;
struct ValueRange { … };
static int enumLength(const EnumDecl *EnumDec) { … }
static bool hasDisjointValueRange(const EnumDecl *Enum1,
const EnumDecl *Enum2) { … }
static bool isNonPowerOf2NorNullLiteral(const EnumConstantDecl *EnumConst) { … }
static bool isMaxValAllBitSetLiteral(const EnumDecl *EnumDec) { … }
static int countNonPowOfTwoLiteralNum(const EnumDecl *EnumDec) { … }
static bool isPossiblyBitMask(const EnumDecl *EnumDec) { … }
SuspiciousEnumUsageCheck::SuspiciousEnumUsageCheck(StringRef Name,
ClangTidyContext *Context)
: … { … }
void SuspiciousEnumUsageCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { … }
void SuspiciousEnumUsageCheck::registerMatchers(MatchFinder *Finder) { … }
void SuspiciousEnumUsageCheck::checkSuspiciousBitmaskUsage(
const Expr *NodeExpr, const EnumDecl *EnumDec) { … }
void SuspiciousEnumUsageCheck::check(const MatchFinder::MatchResult &Result) { … }
}