clang-tools 22.0.0git
clang::tidy::bugprone::ReservedIdentifierCheck Class Referencefinal

Checks for usages of identifiers reserved for use by the implementation. More...

#include <ReservedIdentifierCheck.h>

Inheritance diagram for clang::tidy::bugprone::ReservedIdentifierCheck:
[legend]

Public Member Functions

 ReservedIdentifierCheck (StringRef Name, ClangTidyContext *Context)
void storeOptions (ClangTidyOptions::OptionMap &Opts) override
Public Member Functions inherited from clang::tidy::RenamerClangTidyCheck
 RenamerClangTidyCheck (StringRef CheckName, ClangTidyContext *Context)
 ~RenamerClangTidyCheck ()
void registerMatchers (ast_matchers::MatchFinder *Finder) final
 Derived classes should not implement any matching logic themselves; this class will do the matching and call the derived class' getDeclFailureInfo() and getMacroFailureInfo() for determining whether a given identifier passes or fails the check.
void check (const ast_matchers::MatchFinder::MatchResult &Result) final
void registerPPCallbacks (const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) final
void onEndOfTranslationUnit () final
void storeOptions (ClangTidyOptions::OptionMap &Opts) override
 Derived classes that override this function should call this method from the overridden method.
void checkMacro (const Token &MacroNameTok, const MacroInfo *MI, const SourceManager &SourceMgr)
 Check Macros for style violations.
void expandMacro (const Token &MacroNameTok, const MacroInfo *MI, const SourceManager &SourceMgr)
 Add a usage of a macro if it already has a violation.
void addUsage (const NamedDecl *Decl, SourceRange Range, const SourceManager &SourceMgr)

Additional Inherited Members

Public Types inherited from clang::tidy::RenamerClangTidyCheck
enum class  ShouldFixStatus {
  ShouldFix , ConflictsWithKeyword , ConflictsWithMacroDefinition , FixInvalidIdentifier ,
  IgnoreFailureThreshold , InsideMacro
}
 This enum will be used in select of the diagnostic message. More...
using NamingCheckId = std::pair<SourceLocation, StringRef>
using NamingCheckFailureMap

Detailed Description

Checks for usages of identifiers reserved for use by the implementation.

The C and C++ standards both reserve the following names for such use:

  • identifiers that begin with an underscore followed by an uppercase letter;
  • identifiers in the global namespace that begin with an underscore.

The C standard additionally reserves names beginning with a double underscore, while the C++ standard strengthens this to reserve names with a double underscore occurring anywhere.

For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/bugprone/reserved-identifier.html

Definition at line 31 of file ReservedIdentifierCheck.h.

Constructor & Destructor Documentation

◆ ReservedIdentifierCheck()

clang::tidy::bugprone::ReservedIdentifierCheck::ReservedIdentifierCheck ( StringRef Name,
ClangTidyContext * Context )

Member Function Documentation

◆ storeOptions()

void clang::tidy::bugprone::ReservedIdentifierCheck::storeOptions ( ClangTidyOptions::OptionMap & Opts)
override

The documentation for this class was generated from the following files: