llvm/clang-tools-extra/clang-tidy/readability/EnumInitialValueCheck.cpp

//===--- EnumInitialValueCheck.cpp - clang-tidy ---------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#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) {}

/// Check if \p Enumerator is initialized with a (potentially negated) \c
/// IntegerLiteral.
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) {}

/// Excludes bitfields because enumerators initialized with the result of a
/// bitwise operator on enumeration values or any other expr that is not a
/// potentially negative integer literal.
/// Enumerations where it is not directly clear if they are used with
/// bitmask, evident when enumerators are only initialized with (potentially
/// negative) integer literals, are ignored. This is also the case when all
/// enumerators are powers of two (e.g., 0, 1, 2).
AST_MATCHER(EnumDecl, hasSequentialInitialValues) {}

} // namespace

EnumInitialValueCheck::EnumInitialValueCheck(StringRef Name,
                                             ClangTidyContext *Context)
    :{}

void EnumInitialValueCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {}

void EnumInitialValueCheck::registerMatchers(MatchFinder *Finder) {}

void EnumInitialValueCheck::check(const MatchFinder::MatchResult &Result) {}

} // namespace clang::tidy::readability