#include "EnumInitialValueCheck.h"
#include "../utils/LexerUtils.h"
#include "clang/AST/Decl.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
usingnamespaceclang::ast_matchers;
namespace clang::tidy::readability {
static bool isNoneEnumeratorsInitialized(const EnumDecl &Node) { … }
static bool isOnlyFirstEnumeratorInitialized(const EnumDecl &Node) { … }
static bool areAllEnumeratorsInitialized(const EnumDecl &Node) { … }
static bool isInitializedByLiteral(const EnumConstantDecl *Enumerator) { … }
static void cleanInitialValue(DiagnosticBuilder &Diag,
const EnumConstantDecl *ECD,
const SourceManager &SM,
const LangOptions &LangOpts) { … }
namespace {
AST_MATCHER(EnumDecl, isMacro) { … }
AST_MATCHER(EnumDecl, hasConsistentInitialValues) { … }
AST_MATCHER(EnumDecl, hasZeroInitialValueForFirstEnumerator) { … }
AST_MATCHER(EnumDecl, hasSequentialInitialValues) { … }
}
EnumInitialValueCheck::EnumInitialValueCheck(StringRef Name,
ClangTidyContext *Context)
: … { … }
void EnumInitialValueCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { … }
void EnumInitialValueCheck::registerMatchers(MatchFinder *Finder) { … }
void EnumInitialValueCheck::check(const MatchFinder::MatchResult &Result) { … }
}