#include "ReservedIdentifierCheck.h"
#include "../utils/Matchers.h"
#include "../utils/OptionsUtils.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Token.h"
#include <algorithm>
#include <cctype>
#include <optional>
usingnamespaceclang::ast_matchers;
namespace clang::tidy::bugprone {
static const char DoubleUnderscoreTag[] = …;
static const char UnderscoreCapitalTag[] = …;
static const char GlobalUnderscoreTag[] = …;
static const char NonReservedTag[] = …;
static const char Message[] = …;
static int getMessageSelectIndex(StringRef Tag) { … }
llvm::SmallVector<llvm::Regex>
ReservedIdentifierCheck::parseAllowedIdentifiers() const { … }
ReservedIdentifierCheck::ReservedIdentifierCheck(StringRef Name,
ClangTidyContext *Context)
: … { … }
void ReservedIdentifierCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { … }
static std::string collapseConsecutive(StringRef Str, char C) { … }
static bool hasReservedDoubleUnderscore(StringRef Name,
const LangOptions &LangOpts) { … }
static std::optional<std::string>
getDoubleUnderscoreFixup(StringRef Name, const LangOptions &LangOpts) { … }
static bool startsWithUnderscoreCapital(StringRef Name) { … }
static std::optional<std::string> getUnderscoreCapitalFixup(StringRef Name) { … }
static bool startsWithUnderscoreInGlobalNamespace(StringRef Name,
bool IsInGlobalNamespace,
bool IsMacro) { … }
static std::optional<std::string>
getUnderscoreGlobalNamespaceFixup(StringRef Name, bool IsInGlobalNamespace,
bool IsMacro) { … }
static std::string getNonReservedFixup(std::string Name) { … }
static std::optional<RenamerClangTidyCheck::FailureInfo>
getFailureInfoImpl(StringRef Name, bool IsInGlobalNamespace, bool IsMacro,
const LangOptions &LangOpts, bool Invert,
ArrayRef<llvm::Regex> AllowedIdentifiers) { … }
std::optional<RenamerClangTidyCheck::FailureInfo>
ReservedIdentifierCheck::getDeclFailureInfo(const NamedDecl *Decl,
const SourceManager &) const { … }
std::optional<RenamerClangTidyCheck::FailureInfo>
ReservedIdentifierCheck::getMacroFailureInfo(const Token &MacroNameTok,
const SourceManager &) const { … }
RenamerClangTidyCheck::DiagInfo
ReservedIdentifierCheck::getDiagInfo(const NamingCheckId &ID,
const NamingCheckFailure &Failure) const { … }
}