#include "EnumSizeCheck.h"
#include "../utils/Matchers.h"
#include "../utils/OptionsUtils.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include <algorithm>
#include <cinttypes>
#include <cstdint>
#include <limits>
#include <utility>
usingnamespaceclang::ast_matchers;
namespace clang::tidy::performance {
namespace {
AST_MATCHER(EnumDecl, hasEnumerators) { … }
const std::uint64_t Min8 = …;
const std::uint64_t Max8 = …;
const std::uint64_t Min16 = …;
const std::uint64_t Max16 = …;
const std::uint64_t Min32 = …;
const std::uint64_t Max32 = …;
std::pair<const char *, std::uint32_t>
getNewType(std::size_t Size, std::uint64_t Min, std::uint64_t Max) noexcept { … }
}
EnumSizeCheck::EnumSizeCheck(StringRef Name, ClangTidyContext *Context)
: … { … }
void EnumSizeCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { … }
bool EnumSizeCheck::isLanguageVersionSupported(
const LangOptions &LangOpts) const { … }
void EnumSizeCheck::registerMatchers(MatchFinder *Finder) { … }
void EnumSizeCheck::check(const MatchFinder::MatchResult &Result) { … }
}