clang API Documentation

Public Member Functions | Friends
clang::IdentifierInfo Class Reference

#include <IdentifierTable.h>

List of all members.

Public Member Functions

 IdentifierInfo ()
template<std::size_t StrLen>
bool isStr (const char(&Str)[StrLen]) const
const char * getNameStart () const
unsigned getLength () const
StringRef getName () const
 getName - Return the actual identifier string.
bool hasMacroDefinition () const
void setHasMacroDefinition (bool Val)
tok::TokenKind getTokenID () const
bool hasRevertedTokenIDToIdentifier () const
 True if RevertTokenIDToIdentifier() was called.
void RevertTokenIDToIdentifier ()
 Revert TokenID to tok::identifier; used for GNU libstdc++ 4.2 compatibility.
tok::PPKeywordKind getPPKeywordID () const
tok::ObjCKeywordKind getObjCKeywordID () const
void setObjCKeywordID (tok::ObjCKeywordKind ID)
unsigned getBuiltinID () const
void setBuiltinID (unsigned ID)
unsigned getObjCOrBuiltinID () const
void setObjCOrBuiltinID (unsigned ID)
bool isExtensionToken () const
void setIsExtensionToken (bool Val)
bool isCXX11CompatKeyword () const
void setIsCXX11CompatKeyword (bool Val)
void setIsPoisoned (bool Value=true)
bool isPoisoned () const
 isPoisoned - Return true if this token has been poisoned.
void setIsCPlusPlusOperatorKeyword (bool Val=true)
bool isCPlusPlusOperatorKeyword () const
template<typename T >
T * getFETokenInfo () const
void setFETokenInfo (void *T)
bool isHandleIdentifierCase () const
bool isFromAST () const
void setIsFromAST ()
bool hasChangedSinceDeserialization () const
 Determine whether this identifier has changed since it was loaded from an AST file.
void setChangedSinceDeserialization ()
 Note that this identifier has changed since it was loaded from an AST file.
bool isOutOfDate () const
 Determine whether the information for this identifier is out of date with respect to the external source.
void setOutOfDate (bool OOD)
 Set whether the information for this identifier is out of date with respect to the external source.
bool isImport () const
 Determine whether this is the contextual keyword 'import'.
void setImport (bool I)
 Set whether this identifier is the contextual keyword 'import'.

Friends

class IdentifierTable

Detailed Description

IdentifierInfo - 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.

Definition at line 49 of file IdentifierTable.h.


Constructor & Destructor Documentation

IdentifierInfo::IdentifierInfo ( )

Definition at line 31 of file IdentifierTable.cpp.


Member Function Documentation

unsigned clang::IdentifierInfo::getBuiltinID ( ) const [inline]

getBuiltinID - Return a value indicating whether this is a builtin function. 0 is not-built-in. 1 is builtin-for-some-nonprimary-target. 2+ are specific builtin functions.

Definition at line 179 of file IdentifierTable.h.

Referenced by clang::FunctionDecl::getBuiltinID(), LookupBuiltin(), and clang::Sema::LookupInObjCMethod().

template<typename T >
T* clang::IdentifierInfo::getFETokenInfo ( ) const [inline]

getFETokenInfo/setFETokenInfo - The language front-end is allowed to associate arbitrary metadata with this token.

Definition at line 246 of file IdentifierTable.h.

unsigned clang::IdentifierInfo::getLength ( ) const [inline]

getLength - Efficiently return the length of this identifier info.

Definition at line 109 of file IdentifierTable.h.

Referenced by AddObjCKeyValueCompletions(), CheckExtVectorComponent(), getName(), getPPKeywordID(), getStandardSelLoc(), isStr(), and clang::Sema::MergeTypedefNameDecl().

StringRef clang::IdentifierInfo::getName ( ) const [inline]

getName - Return the actual identifier string.

Definition at line 122 of file IdentifierTable.h.

References getLength(), and getNameStart().

Referenced by clang::Sema::ActOnAsmStmt(), clang::Sema::ActOnPragmaVisibility(), AddObjCKeyValueCompletions(), AddTemplateParameterChunks(), clang::Sema::CheckEquivalentExceptionSpec(), checkIsPointer(), clang::Sema::CheckLiteralOperatorDeclaration(), clang::Sema::CodeCompleteObjCMethodDeclSelector(), clang::Sema::CodeCompleteObjCPropertySynthesizeIvar(), clang::DeclarationName::compare(), clang::SelectorTable::constructSetterName(), clang::ExtVectorElementExpr::containsDuplicateElements(), clang::Sema::CorrectTypo(), clang::Sema::DeclApplyPragmaWeak(), diagnoseBadTypeAttribute(), clang::Sema::DiagnoseUnknownTemplateName(), clang::Sema::DiagnoseUnknownTypeName(), EvaluateHasIncludeCommon(), clang::analyze_printf::PrintfSpecifier::fixType(), clang::analyze_scanf::ScanfSpecifier::fixType(), clang::Diagnostic::FormatDiagnostic(), FormatFunctionParameter(), clang::idx::GlobalSelector::get(), clang::Selector::getAsString(), GetAssumedMessageSendExprType(), getCalleeName(), getDefaultSynthIvarName(), clang::ExtVectorElementExpr::getEncodedElementAccess(), GetFullTypeForDeclarator(), clang::ento::SubEngine::getInitialState(), getIvarAccessString(), clang::AttributeList::getKind(), clang::CodeGen::CodeGenModule::getMangledName(), clang::NamedDecl::getName(), clang::MacroExpansion::getName(), clang::ObjCImplementationDecl::getName(), clang::Selector::getNameForSlot(), getOrderedName(), clang::idx::GlobalSelector::getSelector(), handleAvailabilityAttr(), clang::Preprocessor::HandleDirective(), handleFormatAttr(), handleModeAttr(), handleObjCMethodFamilyAttr(), handleObjCOwnershipTypeAttr(), handleOwnershipAttr(), clang::PragmaNamespace::HandlePragma(), clang::Preprocessor::HandlePragmaPopMacro(), HasAttribute(), HasExtension(), HasFeature(), clang::Sema::ImplicitlyDefineFunction(), clang::ASTImporter::Import(), InheritsFromClassNamed(), InNamespace(), isAttributeLateParsed(), isCharSpecialization(), clang::ento::CheckerContext::isCLibraryFunction(), isReceiverClassOrSuperclass(), IsStructurallyEquivalent(), clang::Expr::isUnusedResultAWarning(), clang::NestedNameSpecifier::print(), PrintMacroDefinition(), printTypeSpec(), clang::PrintingCodeCompleteConsumer::ProcessCodeCompleteResults(), clang::RewriteMacrosInInput(), and clang::ASTReader::updateOutOfDateIdentifier().

const char* clang::IdentifierInfo::getNameStart ( ) const [inline]

getNameStart - Return the beginning of the actual string for this identifier. The returned string is properly null terminated.

Definition at line 96 of file IdentifierTable.h.

Referenced by CheckExtVectorComponent(), getName(), clang::LabelStmt::getName(), clang::ObjCCategoryImplDecl::getName(), clang::ObjCCategoryImplDecl::getNameAsCString(), getPPKeywordID(), and isStr().

tok::ObjCKeywordKind clang::IdentifierInfo::getObjCKeywordID ( ) const [inline]

getObjCKeywordID - Return the Objective-C keyword ID for the this identifier. For example, 'class' will return tok::objc_class if ObjC is enabled.

Definition at line 168 of file IdentifierTable.h.

Referenced by clang::Token::getObjCKeywordID().

unsigned clang::IdentifierInfo::getObjCOrBuiltinID ( ) const [inline]

Definition at line 191 of file IdentifierTable.h.

tok::PPKeywordKind IdentifierInfo::getPPKeywordID ( ) const

getPPKeywordID - Return the preprocessor keyword ID for this identifier. For example, "define" will return tok::pp_define.

Definition at line 188 of file IdentifierTable.cpp.

References CASE, getLength(), getNameStart(), and HASH.

Referenced by clang::Preprocessor::HandleDirective(), and clang::PreprocessingRecord::InclusionDirective().

tok::TokenKind clang::IdentifierInfo::getTokenID ( ) const [inline]

getTokenID - 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.

Definition at line 144 of file IdentifierTable.h.

Referenced by HasFeature(), clang::PTHLexer::Lex(), and clang::TokenLexer::Lex().

bool clang::IdentifierInfo::hasChangedSinceDeserialization ( ) const [inline]

Determine whether this identifier has changed since it was loaded from an AST file.

Definition at line 262 of file IdentifierTable.h.

bool clang::IdentifierInfo::hasMacroDefinition ( ) const [inline]
bool clang::IdentifierInfo::hasRevertedTokenIDToIdentifier ( ) const [inline]

True if RevertTokenIDToIdentifier() was called.

Definition at line 147 of file IdentifierTable.h.

bool clang::IdentifierInfo::isCPlusPlusOperatorKeyword ( ) const [inline]

Definition at line 241 of file IdentifierTable.h.

bool clang::IdentifierInfo::isCXX11CompatKeyword ( ) const [inline]

is/setIsCXX11CompatKeyword - Initialize information about whether or not this language token is a keyword in C++11. This controls compatibility warnings, and is only true when not parsing C++11. Once a compatibility problem has been diagnosed with this keyword, the flag will be cleared.

Definition at line 210 of file IdentifierTable.h.

bool clang::IdentifierInfo::isExtensionToken ( ) const [inline]

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.

Definition at line 197 of file IdentifierTable.h.

bool clang::IdentifierInfo::isFromAST ( ) const [inline]

isFromAST - Return true if the identifier in its current state was loaded from an AST file.

Definition at line 256 of file IdentifierTable.h.

Referenced by clang::Preprocessor::HandlePragmaPoison(), and clang::Preprocessor::setMacroInfo().

bool clang::IdentifierInfo::isHandleIdentifierCase ( ) const [inline]

isHandleIdentifierCase - 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.

Definition at line 252 of file IdentifierTable.h.

Referenced by clang::PTHLexer::Lex(), and clang::TokenLexer::Lex().

bool clang::IdentifierInfo::isImport ( ) const [inline]

Determine whether this is the contextual keyword 'import'.

Definition at line 287 of file IdentifierTable.h.

bool clang::IdentifierInfo::isOutOfDate ( ) const [inline]

Determine whether the information for this identifier is out of date with respect to the external source.

Definition at line 274 of file IdentifierTable.h.

Referenced by isTrivialSingleTokenExpansion().

bool clang::IdentifierInfo::isPoisoned ( ) const [inline]

isPoisoned - Return true if this token has been poisoned.

Definition at line 230 of file IdentifierTable.h.

Referenced by clang::Preprocessor::HandlePragmaPoison(), and clang::TokenLexer::Lex().

template<std::size_t StrLen>
bool clang::IdentifierInfo::isStr ( const char(&)  Str[StrLen]) const [inline]
void clang::IdentifierInfo::RevertTokenIDToIdentifier ( ) [inline]

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.

Definition at line 155 of file IdentifierTable.h.

void clang::IdentifierInfo::setBuiltinID ( unsigned  ID) [inline]
void clang::IdentifierInfo::setChangedSinceDeserialization ( ) [inline]

Note that this identifier has changed since it was loaded from an AST file.

Definition at line 268 of file IdentifierTable.h.

Referenced by clang::Preprocessor::HandlePragmaPoison(), and clang::Preprocessor::setMacroInfo().

void clang::IdentifierInfo::setFETokenInfo ( void *  T) [inline]

Definition at line 247 of file IdentifierTable.h.

Referenced by clang::DeclarationName::setFETokenInfo().

void clang::IdentifierInfo::setHasMacroDefinition ( bool  Val) [inline]
void clang::IdentifierInfo::setImport ( bool  I) [inline]

Set whether this identifier is the contextual keyword 'import'.

Definition at line 290 of file IdentifierTable.h.

Referenced by clang::IdentifierTable::get(), and clang::IdentifierTable::getOwn().

void clang::IdentifierInfo::setIsCPlusPlusOperatorKeyword ( bool  Val = true) [inline]

isCPlusPlusOperatorKeyword/setIsCPlusPlusOperatorKeyword controls whether this identifier is a C++ alternate representation of an operator.

Definition at line 234 of file IdentifierTable.h.

Referenced by AddCXXOperatorKeyword().

void clang::IdentifierInfo::setIsCXX11CompatKeyword ( bool  Val) [inline]

Definition at line 211 of file IdentifierTable.h.

Referenced by AddKeyword().

void clang::IdentifierInfo::setIsExtensionToken ( bool  Val) [inline]

Definition at line 198 of file IdentifierTable.h.

Referenced by AddKeyword().

void clang::IdentifierInfo::setIsFromAST ( ) [inline]
void clang::IdentifierInfo::setIsPoisoned ( bool  Value = true) [inline]

setIsPoisoned - Mark this identifier as poisoned. After poisoning, the Preprocessor will emit an error every time this token is used.

Definition at line 221 of file IdentifierTable.h.

Referenced by clang::Preprocessor::HandlePragmaPoison(), clang::PoisonIdentifierRAIIObject::PoisonIdentifierRAIIObject(), clang::Preprocessor::PoisonSEHIdentifiers(), and clang::PoisonIdentifierRAIIObject::~PoisonIdentifierRAIIObject().

void clang::IdentifierInfo::setObjCKeywordID ( tok::ObjCKeywordKind  ID) [inline]

Definition at line 174 of file IdentifierTable.h.

Referenced by AddObjCKeyword().

void clang::IdentifierInfo::setObjCOrBuiltinID ( unsigned  ID) [inline]

Definition at line 192 of file IdentifierTable.h.

void clang::IdentifierInfo::setOutOfDate ( bool  OOD) [inline]

Set whether the information for this identifier is out of date with respect to the external source.

Definition at line 278 of file IdentifierTable.h.

Referenced by clang::ASTReader::markIdentifierUpToDate().


Friends And Related Function Documentation

friend class IdentifierTable [friend]

Definition at line 80 of file IdentifierTable.h.


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