#include "MagicNumbersCheck.h"
#include "../utils/OptionsUtils.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTTypeTraits.h"
#include "clang/AST/Type.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "llvm/ADT/STLExtras.h"
#include <algorithm>
usingnamespaceclang::ast_matchers;
namespace clang {
static bool isUsedToInitializeAConstant(const MatchFinder::MatchResult &Result,
const DynTypedNode &Node) { … }
static bool isUsedToDefineATypeAlias(const MatchFinder::MatchResult &Result,
const DynTypedNode &Node) { … }
static bool isUsedToDefineABitField(const MatchFinder::MatchResult &Result,
const DynTypedNode &Node) { … }
namespace tidy::readability {
const char DefaultIgnoredIntegerValues[] = …;
const char DefaultIgnoredFloatingPointValues[] = …;
MagicNumbersCheck::MagicNumbersCheck(StringRef Name, ClangTidyContext *Context)
: … { … }
void MagicNumbersCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { … }
void MagicNumbersCheck::registerMatchers(MatchFinder *Finder) { … }
void MagicNumbersCheck::check(const MatchFinder::MatchResult &Result) { … }
bool MagicNumbersCheck::isConstant(const MatchFinder::MatchResult &Result,
const Expr &ExprResult) const { … }
bool MagicNumbersCheck::isIgnoredValue(const IntegerLiteral *Literal) const { … }
bool MagicNumbersCheck::isIgnoredValue(const FloatingLiteral *Literal) const { … }
bool MagicNumbersCheck::isSyntheticValue(const SourceManager *SourceManager,
const IntegerLiteral *Literal) const { … }
bool MagicNumbersCheck::isBitFieldWidth(
const clang::ast_matchers::MatchFinder::MatchResult &Result,
const IntegerLiteral &Literal) const { … }
bool MagicNumbersCheck::isUserDefinedLiteral(
const clang::ast_matchers::MatchFinder::MatchResult &Result,
const clang::Expr &Literal) const { … }
}
}