class IdentifierInfo
Declaration
class IdentifierInfo { /* full declaration omitted */ };
Description
One of these records is kept for each identifier that is lexed. This contains information about whether the token was # define'd, is a language keyword, or if it is a front-end token of some sort (e.g. a variable or function name). The preprocessor keeps this information in a set, and all tok::identifier tokens have a pointer to one of these. It is aligned to 8 bytes because DeclarationName needs the lower 3 bits.
Declared at: clang/include/clang/Basic/IdentifierTable.h:84
Member Variables
- private unsigned int TokenID
- private unsigned int ObjCOrBuiltinID
- private unsigned int HasMacro
- private unsigned int HadMacro
- private unsigned int IsExtension
- private unsigned int IsFutureCompatKeyword
- private unsigned int IsPoisoned
- private unsigned int IsCPPOperatorKeyword
- private unsigned int NeedsHandleIdentifier
- private unsigned int IsFromAST
- private unsigned int ChangedAfterLoad
- private unsigned int FEChangedAfterLoad
- private unsigned int RevertedTokenID
- private unsigned int OutOfDate
- private unsigned int IsModulesImport
- private unsigned int IsMangledOpenMPVariantName
- private unsigned int IsDeprecatedMacro
- private unsigned int IsRestrictExpansion
- private unsigned int IsFinal
- private void* FETokenInfo = nullptr
- private llvm::StringMapEntry<IdentifierInfo*>* Entry = nullptr
Method Overview
- public IdentifierInfo(const clang::IdentifierInfo &)
- public IdentifierInfo(clang::IdentifierInfo &&)
- private IdentifierInfo()
- private void RecomputeNeedsHandleIdentifier()
- public llvm::StringRef deuglifiedName() const
- public unsigned int getBuiltinID() const
- public void * getFETokenInfo() const
- public unsigned int getLength() const
- public llvm::StringRef getName() const
- public const char * getNameStart() const
- public tok::ObjCKeywordKind getObjCKeywordID() const
- public unsigned int getObjCOrBuiltinID() const
- public tok::PPKeywordKind getPPKeywordID() const
- public tok::TokenKind getTokenID() const
- public bool hadMacroDefinition() const
- public bool hasChangedSinceDeserialization() const
- public bool hasFETokenInfoChangedSinceDeserialization() const
- public bool hasMacroDefinition() const
- public bool hasRevertedTokenIDToIdentifier() const
- public bool isCPlusPlusKeyword(const clang::LangOptions & LangOpts) const
- public bool isCPlusPlusOperatorKeyword() const
- public bool isDeprecatedMacro() const
- public bool isEditorPlaceholder() const
- public bool isExtensionToken() const
- public bool isFinal() const
- public bool isFromAST() const
- public bool isFutureCompatKeyword() const
- public bool isHandleIdentifierCase() const
- public bool isKeyword(const clang::LangOptions & LangOpts) const
- public bool isMangledOpenMPVariantName() const
- public bool isModulesImport() const
- public bool isOutOfDate() const
- public bool isPoisoned() const
- public clang::ReservedIdentifierStatus isReserved(const clang::LangOptions & LangOpts) const
- public bool isRestrictExpansion() const
- public template <std::size_t StrLen>bool isStr(const char (&)[StrLen] Str) const
- public bool isStr(llvm::StringRef Str) const
- public void revertIdentifierToTokenID(tok::TokenKind TK)
- public void revertTokenIDToIdentifier()
- public void setBuiltinID(unsigned int ID)
- public void setChangedSinceDeserialization()
- public void setFETokenInfo(void * T)
- public void setFETokenInfoChangedSinceDeserialization()
- public void setHasMacroDefinition(bool Val)
- public void setIsCPlusPlusOperatorKeyword(bool Val = true)
- public void setIsDeprecatedMacro(bool Val)
- public void setIsExtensionToken(bool Val)
- public void setIsFinal(bool Val)
- public void setIsFromAST()
- public void setIsFutureCompatKeyword(bool Val)
- public void setIsPoisoned(bool Value = true)
- public void setIsRestrictExpansion(bool Val)
- public void setMangledOpenMPVariantName(bool I)
- public void setModulesImport(bool I)
- public void setObjCKeywordID(tok::ObjCKeywordKind ID)
- public void setObjCOrBuiltinID(unsigned int ID)
- public void setOutOfDate(bool OOD)
Methods
¶IdentifierInfo(const clang::IdentifierInfo&)
IdentifierInfo(const clang::IdentifierInfo&)
Declared at: clang/include/clang/Basic/IdentifierTable.h:167
Parameters
- const clang::IdentifierInfo&
¶IdentifierInfo(clang::IdentifierInfo&&)
IdentifierInfo(clang::IdentifierInfo&&)
Declared at: clang/include/clang/Basic/IdentifierTable.h:169
Parameters
¶IdentifierInfo()
IdentifierInfo()
Declared at: clang/include/clang/Basic/IdentifierTable.h:157
¶void RecomputeNeedsHandleIdentifier()
void RecomputeNeedsHandleIdentifier()
Description
The Preprocessor::HandleIdentifier does several special (but rare) things to identifiers of various sorts. For example, it changes the\c for keyword token from tok::identifier to tok::for. This method is very tied to the definition of HandleIdentifier. Any change to it should be reflected here.
Declared at: clang/include/clang/Basic/IdentifierTable.h:477
¶llvm::StringRef deuglifiedName() const
llvm::StringRef deuglifiedName() const
Description
If the identifier is an "uglified" reserved name, return a cleaned form. e.g. _Foo => Foo. Otherwise, just returns the name.
Declared at: clang/include/clang/Basic/IdentifierTable.h:463
¶unsigned int getBuiltinID() const
unsigned int getBuiltinID() const
Description
Return a value indicating whether this is a builtin function. 0 is not-built-in. 1+ are specific builtin functions.
Declared at: clang/include/clang/Basic/IdentifierTable.h:302
¶void* getFETokenInfo() const
void* getFETokenInfo() const
Description
Get and set FETokenInfo. The language front-end is allowed to associate arbitrary metadata with this token.
Declared at: clang/include/clang/Basic/IdentifierTable.h:372
¶unsigned int getLength() const
unsigned int getLength() const
Description
Efficiently return the length of this identifier info.
Declared at: clang/include/clang/Basic/IdentifierTable.h:192
¶llvm::StringRef getName() const
llvm::StringRef getName() const
Description
Return the actual identifier string.
Declared at: clang/include/clang/Basic/IdentifierTable.h:195
¶const char* getNameStart() const
const char* getNameStart() const
Description
Return the beginning of the actual null-terminated string for this identifier.
Declared at: clang/include/clang/Basic/IdentifierTable.h:189
¶tok::ObjCKeywordKind getObjCKeywordID() const
tok::ObjCKeywordKind getObjCKeywordID() const
Description
Return the Objective-C keyword ID for the this identifier. For example, 'class' will return tok::objc_class if ObjC is enabled.
Declared at: clang/include/clang/Basic/IdentifierTable.h:291
¶unsigned int getObjCOrBuiltinID() const
unsigned int getObjCOrBuiltinID() const
Declared at: clang/include/clang/Basic/IdentifierTable.h:314
¶tok::PPKeywordKind getPPKeywordID() const
tok::PPKeywordKind getPPKeywordID() const
Description
Return the preprocessor keyword ID for this identifier. For example, "define" will return tok::pp_define.
Declared at: clang/include/clang/Basic/IdentifierTable.h:286
¶tok::TokenKind getTokenID() const
tok::TokenKind getTokenID() const
Description
If this is a source-language token (e.g. 'for'), this API can be used to cause the lexer to map identifiers to source-language tokens.
Declared at: clang/include/clang/Basic/IdentifierTable.h:261
¶bool hadMacroDefinition() const
bool hadMacroDefinition() const
Description
Returns true if this identifier was # defined to some value at any moment. In this case there should be an entry for the identifier in the macro history table in Preprocessor.
Declared at: clang/include/clang/Basic/IdentifierTable.h:226
¶bool hasChangedSinceDeserialization() const
bool hasChangedSinceDeserialization() const
Description
Determine whether this identifier has changed since it was loaded from an AST file.
Declared at: clang/include/clang/Basic/IdentifierTable.h:390
¶bool hasFETokenInfoChangedSinceDeserialization()
const
bool hasFETokenInfoChangedSinceDeserialization()
const
Description
Determine whether the frontend token information for this identifier has changed since it was loaded from an AST file.
Declared at: clang/include/clang/Basic/IdentifierTable.h:402
¶bool hasMacroDefinition() const
bool hasMacroDefinition() const
Description
Return true if this identifier is # defined to some other value.
Declared at: clang/include/clang/Basic/IdentifierTable.h:201
¶bool hasRevertedTokenIDToIdentifier() const
bool hasRevertedTokenIDToIdentifier() const
Description
True if revertTokenIDToIdentifier() was called.
Declared at: clang/include/clang/Basic/IdentifierTable.h:264
¶bool isCPlusPlusKeyword(
const clang::LangOptions& LangOpts) const
bool isCPlusPlusKeyword(
const clang::LangOptions& LangOpts) const
Description
Return true if this token is a C++ keyword in the specified language.
Declared at: clang/include/clang/Basic/IdentifierTable.h:368
Parameters
- const clang::LangOptions& LangOpts
¶bool isCPlusPlusOperatorKeyword() const
bool isCPlusPlusOperatorKeyword() const
Declared at: clang/include/clang/Basic/IdentifierTable.h:361
¶bool isDeprecatedMacro() const
bool isDeprecatedMacro() const
Declared at: clang/include/clang/Basic/IdentifierTable.h:230
¶bool isEditorPlaceholder() const
bool isEditorPlaceholder() const
Description
Return true if this identifier is an editor placeholder. Editor placeholders are produced by the code-completion engine and are represented as characters between ' < #' and '#>' in the source code. An example of auto-completed call with a placeholder parameter is shown below:
Declared at: clang/include/clang/Basic/IdentifierTable.h:453
¶bool isExtensionToken() const
bool isExtensionToken() const
Description
get/setExtension - Initialize information about whether or not this language token is an extension. This controls extension warnings, and is only valid if a custom token ID is set.
Declared at: clang/include/clang/Basic/IdentifierTable.h:320
¶bool isFinal() const
bool isFinal() const
Declared at: clang/include/clang/Basic/IdentifierTable.h:254
¶bool isFromAST() const
bool isFromAST() const
Description
Return true if the identifier in its current state was loaded from an AST file.
Declared at: clang/include/clang/Basic/IdentifierTable.h:384
¶bool isFutureCompatKeyword() const
bool isFutureCompatKeyword() const
Description
is/setIsFutureCompatKeyword - Initialize information about whether or not this language token is a keyword in a newer or proposed Standard. This controls compatibility warnings, and is only true when not parsing the corresponding Standard. Once a compatibility problem has been diagnosed with this keyword, the flag will be cleared.
Declared at: clang/include/clang/Basic/IdentifierTable.h:334
¶bool isHandleIdentifierCase() const
bool isHandleIdentifierCase() const
Description
Return true if the Preprocessor::HandleIdentifier must be called on a token of this identifier. If this returns false, we know that HandleIdentifier will not affect the token.
Declared at: clang/include/clang/Basic/IdentifierTable.h:380
¶bool isKeyword(
const clang::LangOptions& LangOpts) const
bool isKeyword(
const clang::LangOptions& LangOpts) const
Description
Return true if this token is a keyword in the specified language.
Declared at: clang/include/clang/Basic/IdentifierTable.h:364
Parameters
- const clang::LangOptions& LangOpts
¶bool isMangledOpenMPVariantName() const
bool isMangledOpenMPVariantName() const
Description
Determine whether this is the mangled name of an OpenMP variant.
Declared at: clang/include/clang/Basic/IdentifierTable.h:439
¶bool isModulesImport() const
bool isModulesImport() const
Description
Determine whether this is the contextual keyword \c import.
Declared at: clang/include/clang/Basic/IdentifierTable.h:427
¶bool isOutOfDate() const
bool isOutOfDate() const
Description
Determine whether the information for this identifier is out of date with respect to the external source.
Declared at: clang/include/clang/Basic/IdentifierTable.h:414
¶bool isPoisoned() const
bool isPoisoned() const
Description
Return true if this token has been poisoned.
Declared at: clang/include/clang/Basic/IdentifierTable.h:354
¶clang::ReservedIdentifierStatus isReserved(
const clang::LangOptions& LangOpts) const
clang::ReservedIdentifierStatus isReserved(
const clang::LangOptions& LangOpts) const
Description
Determine whether \p this is a name reserved for the implementation (C99 7.1.3, C++ [lib.global.names]).
Declared at: clang/include/clang/Basic/IdentifierTable.h:459
Parameters
- const clang::LangOptions& LangOpts
¶bool isRestrictExpansion() const
bool isRestrictExpansion() const
Declared at: clang/include/clang/Basic/IdentifierTable.h:242
¶template <std::size_t StrLen>
bool isStr(const char (&)[StrLen] Str) const
template <std::size_t StrLen>
bool isStr(const char (&)[StrLen] Str) const
Description
Return true if this is the identifier for the specified string. This is intended to be used for string literals only: II->isStr("foo").
Declared at: clang/include/clang/Basic/IdentifierTable.h:176
Templates
- std::size_t StrLen
Parameters
- const char (&)[StrLen] Str
¶bool isStr(llvm::StringRef Str) const
bool isStr(llvm::StringRef Str) const
Description
Return true if this is the identifier for the specified StringRef.
Declared at: clang/include/clang/Basic/IdentifierTable.h:182
Parameters
- llvm::StringRef Str
¶void revertIdentifierToTokenID(tok::TokenKind TK)
void revertIdentifierToTokenID(tok::TokenKind TK)
Declared at: clang/include/clang/Basic/IdentifierTable.h:277
Parameters
- tok::TokenKind TK
¶void revertTokenIDToIdentifier()
void revertTokenIDToIdentifier()
Description
Revert TokenID to tok::identifier; used for GNU libstdc++ 4.2 compatibility. TokenID is normally read-only but there are 2 instances where we revert it to tok::identifier for libstdc++ 4.2. Keep track of when this happens using this method so we can inform serialization about it.
Declared at: clang/include/clang/Basic/IdentifierTable.h:272
¶void setBuiltinID(unsigned int ID)
void setBuiltinID(unsigned int ID)
Declared at: clang/include/clang/Basic/IdentifierTable.h:308
Parameters
- unsigned int ID
¶void setChangedSinceDeserialization()
void setChangedSinceDeserialization()
Description
Note that this identifier has changed since it was loaded from an AST file.
Declared at: clang/include/clang/Basic/IdentifierTable.h:396
¶void setFETokenInfo(void* T)
void setFETokenInfo(void* T)
Declared at: clang/include/clang/Basic/IdentifierTable.h:373
Parameters
- void* T
¶void setFETokenInfoChangedSinceDeserialization()
void setFETokenInfoChangedSinceDeserialization()
Description
Note that the frontend token information for this identifier has changed since it was loaded from an AST file.
Declared at: clang/include/clang/Basic/IdentifierTable.h:408
¶void setHasMacroDefinition(bool Val)
void setHasMacroDefinition(bool Val)
Declared at: clang/include/clang/Basic/IdentifierTable.h:204
Parameters
- bool Val
¶void setIsCPlusPlusOperatorKeyword(
bool Val = true)
void setIsCPlusPlusOperatorKeyword(
bool Val = true)
Description
isCPlusPlusOperatorKeyword/setIsCPlusPlusOperatorKeyword controls whether this identifier is a C++ alternate representation of an operator.
Declared at: clang/include/clang/Basic/IdentifierTable.h:358
Parameters
- bool Val = true
¶void setIsDeprecatedMacro(bool Val)
void setIsDeprecatedMacro(bool Val)
Declared at: clang/include/clang/Basic/IdentifierTable.h:232
Parameters
- bool Val
¶void setIsExtensionToken(bool Val)
void setIsExtensionToken(bool Val)
Declared at: clang/include/clang/Basic/IdentifierTable.h:321
Parameters
- bool Val
¶void setIsFinal(bool Val)
void setIsFinal(bool Val)
Declared at: clang/include/clang/Basic/IdentifierTable.h:256
Parameters
- bool Val
¶void setIsFromAST()
void setIsFromAST()
Declared at: clang/include/clang/Basic/IdentifierTable.h:386
¶void setIsFutureCompatKeyword(bool Val)
void setIsFutureCompatKeyword(bool Val)
Declared at: clang/include/clang/Basic/IdentifierTable.h:335
Parameters
- bool Val
¶void setIsPoisoned(bool Value = true)
void setIsPoisoned(bool Value = true)
Description
setIsPoisoned - Mark this identifier as poisoned. After poisoning, the Preprocessor will emit an error every time this token is used.
Declared at: clang/include/clang/Basic/IdentifierTable.h:345
Parameters
- bool Value = true
¶void setIsRestrictExpansion(bool Val)
void setIsRestrictExpansion(bool Val)
Declared at: clang/include/clang/Basic/IdentifierTable.h:244
Parameters
- bool Val
¶void setMangledOpenMPVariantName(bool I)
void setMangledOpenMPVariantName(bool I)
Description
Set whether this is the mangled name of an OpenMP variant.
Declared at: clang/include/clang/Basic/IdentifierTable.h:442
Parameters
- bool I
¶void setModulesImport(bool I)
void setModulesImport(bool I)
Description
Set whether this identifier is the contextual keyword \c import.
Declared at: clang/include/clang/Basic/IdentifierTable.h:430
Parameters
- bool I
¶void setObjCKeywordID(tok::ObjCKeywordKind ID)
void setObjCKeywordID(tok::ObjCKeywordKind ID)
Declared at: clang/include/clang/Basic/IdentifierTable.h:297
Parameters
- tok::ObjCKeywordKind ID
¶void setObjCOrBuiltinID(unsigned int ID)
void setObjCOrBuiltinID(unsigned int ID)
Declared at: clang/include/clang/Basic/IdentifierTable.h:315
Parameters
- unsigned int ID
¶void setOutOfDate(bool OOD)
void setOutOfDate(bool OOD)
Description
Set whether the information for this identifier is out of date with respect to the external source.
Declared at: clang/include/clang/Basic/IdentifierTable.h:418
Parameters
- bool OOD