clang
3.9.0
|
One of these records is kept for each identifier that is lexed. More...
#include <IdentifierTable.h>
Public Member Functions | |
IdentifierInfo () | |
template<std::size_t StrLen> | |
bool | isStr (const char(&Str)[StrLen]) const |
Return true if this is the identifier for the specified string. More... | |
const char * | getNameStart () const |
Return the beginning of the actual null-terminated string for this identifier. More... | |
unsigned | getLength () const |
Efficiently return the length of this identifier info. More... | |
StringRef | getName () const |
Return the actual identifier string. More... | |
bool | hasMacroDefinition () const |
Return true if this identifier is #defined to some other value. More... | |
void | setHasMacroDefinition (bool Val) |
bool | hadMacroDefinition () const |
Returns true if this identifier was #defined to some value at any moment. More... | |
tok::TokenKind | getTokenID () const |
If this is a source-language token (e.g. More... | |
bool | hasRevertedTokenIDToIdentifier () const |
True if revertTokenIDToIdentifier() was called. More... | |
void | revertTokenIDToIdentifier () |
Revert TokenID to tok::identifier; used for GNU libstdc++ 4.2 compatibility. More... | |
void | revertIdentifierToTokenID (tok::TokenKind TK) |
tok::PPKeywordKind | getPPKeywordID () const |
Return the preprocessor keyword ID for this identifier. More... | |
tok::ObjCKeywordKind | getObjCKeywordID () const |
Return the Objective-C keyword ID for the this identifier. More... | |
void | setObjCKeywordID (tok::ObjCKeywordKind ID) |
bool | hasRevertedBuiltin () const |
True if setNotBuiltin() was called. More... | |
void | revertBuiltin () |
Revert the identifier to a non-builtin identifier. More... | |
unsigned | getBuiltinID () const |
Return a value indicating whether this is a builtin function. More... | |
void | setBuiltinID (unsigned ID) |
unsigned | getObjCOrBuiltinID () const |
void | setObjCOrBuiltinID (unsigned ID) |
bool | isExtensionToken () const |
get/setExtension - Initialize information about whether or not this language token is an extension. More... | |
void | setIsExtensionToken (bool Val) |
bool | isFutureCompatKeyword () const |
is/setIsFutureCompatKeyword - Initialize information about whether or not this language token is a keyword in a newer or proposed Standard. More... | |
void | setIsFutureCompatKeyword (bool Val) |
void | setIsPoisoned (bool Value=true) |
setIsPoisoned - Mark this identifier as poisoned. More... | |
bool | isPoisoned () const |
Return true if this token has been poisoned. More... | |
void | setIsCPlusPlusOperatorKeyword (bool Val=true) |
isCPlusPlusOperatorKeyword/setIsCPlusPlusOperatorKeyword controls whether this identifier is a C++ alternate representation of an operator. More... | |
bool | isCPlusPlusOperatorKeyword () const |
bool | isKeyword (const LangOptions &LangOpts) |
Return true if this token is a keyword in the specified language. More... | |
template<typename T > | |
T * | getFETokenInfo () const |
getFETokenInfo/setFETokenInfo - The language front-end is allowed to associate arbitrary metadata with this token. More... | |
void | setFETokenInfo (void *T) |
bool | isHandleIdentifierCase () const |
Return true if the Preprocessor::HandleIdentifier must be called on a token of this identifier. More... | |
bool | isFromAST () const |
Return true if the identifier in its current state was loaded from an AST file. More... | |
void | setIsFromAST () |
bool | hasChangedSinceDeserialization () const |
Determine whether this identifier has changed since it was loaded from an AST file. More... | |
void | setChangedSinceDeserialization () |
Note that this identifier has changed since it was loaded from an AST file. More... | |
bool | hasFETokenInfoChangedSinceDeserialization () const |
Determine whether the frontend token information for this identifier has changed since it was loaded from an AST file. More... | |
void | setFETokenInfoChangedSinceDeserialization () |
Note that the frontend token information for this identifier has changed since it was loaded from an AST file. More... | |
bool | isOutOfDate () const |
Determine whether the information for this identifier is out of date with respect to the external source. More... | |
void | setOutOfDate (bool OOD) |
Set whether the information for this identifier is out of date with respect to the external source. More... | |
bool | isModulesImport () const |
Determine whether this is the contextual keyword import . More... | |
void | setModulesImport (bool I) |
Set whether this identifier is the contextual keyword import . More... | |
bool | operator< (const IdentifierInfo &RHS) const |
Provide less than operator for lexicographical sorting. More... | |
Friends | |
class | IdentifierTable |
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 47 of file IdentifierTable.h.
IdentifierInfo::IdentifierInfo | ( | ) |
Definition at line 33 of file IdentifierTable.cpp.
|
inline |
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 210 of file IdentifierTable.h.
References clang::tok::NUM_OBJC_KEYWORDS.
Referenced by clang::FunctionDecl::getBuiltinID(), clang::ASTImporter::Import(), LookupBuiltin(), and clang::Sema::LookupInObjCMethod().
|
inline |
getFETokenInfo/setFETokenInfo - The language front-end is allowed to associate arbitrary metadata with this token.
Definition at line 281 of file IdentifierTable.h.
Referenced by isInterestingIdentifier().
|
inline |
Efficiently return the length of this identifier info.
Definition at line 113 of file IdentifierTable.h.
Referenced by AddObjCKeyValueCompletions(), CheckExtVectorComponent(), getName(), getPPKeywordID(), getStandardSelLoc(), clang::Sema::isCurrentClassNameTypo(), isReservedName(), isStr(), and clang::Sema::MergeTypedefNameDecl().
|
inline |
Return the actual identifier string.
Definition at line 126 of file IdentifierTable.h.
References getLength(), and getNameStart().
Referenced by clang::Sema::ActOnFinishKNRParamDeclarations(), clang::Sema::ActOnGCCAsmStmt(), clang::Sema::ActOnPragmaRedefineExtname(), clang::Sema::ActOnPragmaVisibility(), clang::comments::Sema::actOnTParamCommandParamNameArg(), clang::Sema::ActOnVariableDeclarator(), clang::TypoCorrectionConsumer::addCorrection(), clang::Sema::AddModeAttr(), AddObjCKeyValueCompletions(), AddObjCProperties(), AddTemplateParameterChunks(), appendEnumType(), appendRecordType(), clang::ento::AnyFunctionCall::argumentsMayEscape(), attributeHasIdentifierArg(), attributeIsTypeArgAttr(), attributeParsedArgsUnevaluated(), checkAvailabilityAttr(), clang::Sema::CheckEquivalentExceptionSpec(), clang::Sema::CheckLiteralOperatorDeclaration(), clang::Sema::checkStringLiteralArgumentAttr(), clang::Sema::ClassifyName(), clang::Sema::CodeCompleteObjCMethodDeclSelector(), clang::Sema::CodeCompleteObjCPropertySynthesizeIvar(), clang::DeclarationName::compare(), clang::SelectorTable::constructSetterSelector(), clang::ExtVectorElementExpr::containsDuplicateElements(), clang::Sema::CorrectTypo(), clang::Sema::CorrectTypoDelayed(), clang::comments::Sema::correctTypoInTParamReference(), clang::CodeGen::CGOpenMPRuntime::createOffloadEntry(), clang::Sema::DeclApplyPragmaWeak(), diagnoseBadTypeAttribute(), DiagnoseNamespaceInlineMismatch(), clang::Sema::DiagnoseUnknownTemplateName(), clang::Sema::DiagnoseUnknownTypeName(), distributeNullabilityTypeAttr(), clang::MacroInfo::dump(), EvaluateHasIncludeCommon(), findKnownClass(), clang::ento::coreFoundation::followsCreateRule(), FormatFunctionParameter(), clang::TypoCorrectionConsumer::FoundDecl(), clang::index::generateUSRForMacro(), clang::Selector::getAsString(), GetAssumedMessageSendExprType(), clang::AttributeList::getAttributeSpellingListIndex(), getCalleeName(), clang::ento::CheckerContext::getCalleeName(), getCCTypeAttrKind(), clang::ObjCPropertyDecl::getDefaultSynthIvarName(), clang::ExtVectorElementExpr::getEncodedElementAccess(), GetFullTypeForDeclarator(), getFunctionName(), getFutureCompatDiagKind(), getImageAccessAttrStr(), clang::ento::ExprEngine::getInitialState(), clang::Selector::getInstTypeMethodFamily(), clang::AttributeList::getKind(), clang::CodeGen::CodeGenModule::getMangledName(), clang::MacroExpansion::getName(), clang::NamedDecl::getName(), clang::ObjCCategoryImplDecl::getName(), clang::ObjCImplementationDecl::getName(), clang::Selector::getNameForSlot(), getOrderedName(), handleArgumentWithTypeTagAttr(), handleAvailabilityAttr(), handleBlocksAttr(), handleCallableWhenAttr(), handleConsumableAttr(), handleFormatAttr(), handleLoopHintAttr(), handleNoSanitizeSpecificAttr(), handleObjCMethodFamilyAttr(), handleObjCOwnershipTypeAttr(), handleOpenCLAccessAttr(), handleOwnershipAttr(), handleParamTypestateAttr(), clang::PragmaNamespace::HandlePragma(), clang::Preprocessor::HandlePragmaPopMacro(), handleReturnTypestateAttr(), handleSetTypestateAttr(), handleTargetFeaturesGroup(), handleTestTypestateAttr(), clang::hasAttribute(), clang::Sema::ImplicitlyDefineFunction(), clang::ASTImporter::Import(), clang::CallGraph::includeInGraph(), InheritsFromClassNamed(), InNamespace(), isAttributeLateParsed(), IsBuiltInOrStandardCXX11Attribute(), IsCategoryNameWithDeprecatedSuffix(), isCharSpecialization(), clang::ento::CheckerContext::isCLibraryFunction(), clang::ento::cocoa::isCocoaObjectRef(), isConfigurationPattern(), isCPPStdLibraryFunction(), clang::Sema::isCurrentClassNameTypo(), IsStructurallyEquivalent(), clang::MangleContext::mangleGlobalBlock(), clang::MangleContext::mangleName(), clang::Sema::mergeAvailabilityAttr(), clang::analyze_format_string::FormatSpecifier::namedTypeToLengthModifier(), operator<(), parseDeclareSimdClauses(), clang::Parser::ParseMSAsmIdentifier(), PragmaLoopHintString(), clang::NestedNameSpecifier::print(), clang::DeclarationName::print(), PrintMacroDefinition(), clang::PrintingCodeCompleteConsumer::ProcessCodeCompleteResults(), clang::comments::Sema::resolveParmVarReference(), clang::RewriteMacrosInInput(), rewriteToNSEnumDecl(), rewriteToNSMacroDecl(), clang::Sema::setTagNameForLinkagePurposes(), shouldNotPrintDirectly(), shouldWarnOnMacroDef(), shouldWarnOnMacroUndef(), TryNamespaceTypoCorrection(), clang::ASTReader::updateOutOfDateIdentifier(), and ValidateObjCLiteralInterfaceDecl().
|
inline |
Return the beginning of the actual null-terminated string for this identifier.
Definition at line 100 of file IdentifierTable.h.
Referenced by CheckExtVectorComponent(), clang::Preprocessor::dumpMacroInfo(), getName(), clang::LabelStmt::getName(), getPPKeywordID(), isReservedName(), and isStr().
|
inline |
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 186 of file IdentifierTable.h.
References clang::tok::NUM_OBJC_KEYWORDS.
Referenced by clang::Token::getObjCKeywordID().
|
inline |
Definition at line 222 of file IdentifierTable.h.
Referenced by isInterestingIdentifier().
tok::PPKeywordKind IdentifierInfo::getPPKeywordID | ( | ) | const |
Return the preprocessor keyword ID for this identifier.
For example, "define" will return tok::pp_define.
Definition at line 255 of file IdentifierTable.cpp.
References CASE, getLength(), getNameStart(), HASH, and clang::Name.
Referenced by clang::format::ContinuationIndenter::addTokenToState(), clang::Preprocessor::CheckMacroName(), diagnoseAutoModuleImport(), clang::Preprocessor::HandleDirective(), and clang::format::FormatToken::is().
|
inline |
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 156 of file IdentifierTable.h.
Referenced by DiagnoseCallingConvCast(), isKeyword(), IsValidIdentifier(), clang::PTHLexer::Lex(), and clang::TokenLexer::Lex().
|
inline |
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.
Definition at line 149 of file IdentifierTable.h.
Referenced by checkConfigMacro(), clang::Preprocessor::getLocalMacroDirectiveHistory(), clang::Preprocessor::getMacroDefinitionAtLoc(), and isInterestingIdentifier().
|
inline |
Determine whether this identifier has changed since it was loaded from an AST file.
Definition at line 299 of file IdentifierTable.h.
|
inline |
Determine whether the frontend token information for this identifier has changed since it was loaded from an AST file.
Definition at line 311 of file IdentifierTable.h.
|
inline |
Return true if this identifier is #defined to some other value.
Definition at line 132 of file IdentifierTable.h.
Referenced by clang::Preprocessor::getLocalMacroDirective(), clang::Preprocessor::getMacroDefinition(), clang::Preprocessor::getMacroInfo(), clang::NSAPI::isMacroDefined(), clang::Preprocessor::isMacroDefined(), and clang::Preprocessor::isMacroDefinedInLocalModule().
|
inline |
True if setNotBuiltin() was called.
Definition at line 195 of file IdentifierTable.h.
References clang::tok::NUM_OBJC_KEYWORDS.
Referenced by isInterestingIdentifier().
|
inline |
True if revertTokenIDToIdentifier() was called.
Definition at line 159 of file IdentifierTable.h.
Referenced by isInterestingIdentifier().
|
inline |
Definition at line 273 of file IdentifierTable.h.
Referenced by clang::Preprocessor::CheckMacroName().
|
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 228 of file IdentifierTable.h.
|
inline |
Return true if the identifier in its current state was loaded from an AST file.
Definition at line 293 of file IdentifierTable.h.
Referenced by clang::Preprocessor::appendMacroDirective(), clang::Preprocessor::HandlePragmaPoison(), and markIdentifierFromAST().
|
inline |
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.
Definition at line 242 of file IdentifierTable.h.
Referenced by getFutureCompatDiagKind().
|
inline |
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 289 of file IdentifierTable.h.
Referenced by clang::PTHLexer::Lex(), and clang::TokenLexer::Lex().
bool IdentifierInfo::isKeyword | ( | const LangOptions & | LangOpts | ) |
Return true if this token is a keyword in the specified language.
Returns true if the identifier represents a keyword in the specified language.
Definition at line 245 of file IdentifierTable.cpp.
References getTokenID(), and getTokenKwStatus().
Referenced by DiagnoseCallingConvCast(), isConfigurationPattern(), and shouldWarnOnMacroDef().
|
inline |
Determine whether this is the contextual keyword import
.
Definition at line 336 of file IdentifierTable.h.
|
inline |
Determine whether the information for this identifier is out of date with respect to the external source.
Definition at line 323 of file IdentifierTable.h.
Referenced by clang::HeaderFileInfo::getControllingMacro(), isTrivialSingleTokenExpansion(), and clang::ASTReader::ReadDefinedMacros().
|
inline |
Return true if this token has been poisoned.
Definition at line 262 of file IdentifierTable.h.
Referenced by clang::Preprocessor::HandleIdentifier(), clang::Preprocessor::HandlePragmaPoison(), isInterestingIdentifier(), and clang::TokenLexer::Lex().
|
inline |
Return true if this is the identifier for the specified string.
This is intended to be used for string literals only: II->isStr("foo").
Definition at line 93 of file IdentifierTable.h.
References getLength(), and getNameStart().
Referenced by clang::Sema::ActOnClassPropertyRefExpr(), clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnStartNamespaceDef(), clang::Sema::ActOnTag(), clang::Sema::ActOnUsingDirective(), clang::Sema::ActOnVariableDeclarator(), clang::Sema::AddKnownFunctionAttributes(), clang::ento::AnyFunctionCall::argumentsMayEscape(), clang::ObjCMethodCall::argumentsMayEscape(), CheckMoveOnConstruction(), clang::Sema::ConversionToObjCStringLiteralCheck(), diagnoseBadTypeAttribute(), DiagnoseDirectIsaAccess(), clang::Sema::DiagnoseSelfMove(), findCapturingExpr(), clang::FunctionDecl::getMemoryFunctionKind(), handleDeprecatedAttr(), handleLoopHintAttr(), handleObjCBridgeAttr(), handleObjCGCTypeAttr(), handleObjCOwnershipTypeAttr(), clang::TemplateDeclInstantiator::InstantiateTypedefNameDecl(), isEnableIf(), IsFunctionStdAbs(), clang::TypoCorrection::isKeyword(), clang::Sema::isLibstdcxxEagerExceptionSpecHack(), isNamed(), isStd(), clang::DeclContext::isStdNamespace(), isStreamCharSpecialization(), isWideStringLiteralFromMacro(), clang::Preprocessor::LexOnOffSwitch(), LookupMemberExpr(), LookupPredefedObjCSuperType(), clang::Sema::MergeTypedefNameDecl(), ParseAlignPragma(), processTypeAttrs(), and clang::CodeGen::CodeGenFunction::StartObjCMethod().
|
inline |
Provide less than operator for lexicographical sorting.
Definition at line 348 of file IdentifierTable.h.
References getName().
|
inline |
Revert the identifier to a non-builtin identifier.
We do this if the name of a known builtin library function is used to declare that function, but an unexpected type is specified.
Definition at line 202 of file IdentifierTable.h.
References setBuiltinID().
Referenced by clang::Sema::MergeFunctionDecl().
|
inline |
Definition at line 172 of file IdentifierTable.h.
|
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 167 of file IdentifierTable.h.
|
inline |
Definition at line 216 of file IdentifierTable.h.
References clang::tok::NUM_OBJC_KEYWORDS.
Referenced by clang::Builtin::Context::forgetBuiltin(), clang::ASTImporter::Import(), clang::Builtin::Context::initializeBuiltins(), and revertBuiltin().
|
inline |
Note that this identifier has changed since it was loaded from an AST file.
Definition at line 305 of file IdentifierTable.h.
Referenced by clang::Preprocessor::appendMacroDirective(), clang::Preprocessor::HandlePragmaPoison(), and markIdentifierFromAST().
|
inline |
Definition at line 282 of file IdentifierTable.h.
Referenced by clang::DeclarationName::setFETokenInfo().
|
inline |
Note that the frontend token information for this identifier has changed since it was loaded from an AST file.
Definition at line 317 of file IdentifierTable.h.
|
inline |
Definition at line 135 of file IdentifierTable.h.
Referenced by clang::Preprocessor::addModuleMacro(), clang::Preprocessor::appendMacroDirective(), and clang::Preprocessor::setLoadedMacroDirective().
isCPlusPlusOperatorKeyword/setIsCPlusPlusOperatorKeyword controls whether this identifier is a C++ alternate representation of an operator.
Definition at line 266 of file IdentifierTable.h.
Referenced by AddCXXOperatorKeyword().
|
inline |
Definition at line 229 of file IdentifierTable.h.
Referenced by AddKeyword().
|
inline |
Definition at line 295 of file IdentifierTable.h.
Referenced by markIdentifierFromAST().
|
inline |
Definition at line 243 of file IdentifierTable.h.
Referenced by AddKeyword().
setIsPoisoned - Mark this identifier as poisoned.
After poisoning, the Preprocessor will emit an error every time this token is used.
Definition at line 253 of file IdentifierTable.h.
Referenced by clang::Preprocessor::HandlePragmaPoison(), clang::PoisonIdentifierRAIIObject::PoisonIdentifierRAIIObject(), clang::Preprocessor::PoisonSEHIdentifiers(), and clang::PoisonIdentifierRAIIObject::~PoisonIdentifierRAIIObject().
|
inline |
Set whether this identifier is the contextual keyword import
.
Definition at line 339 of file IdentifierTable.h.
References I.
Referenced by clang::IdentifierTable::getOwn().
|
inline |
|
inline |
Definition at line 223 of file IdentifierTable.h.
References ID.
|
inline |
Set whether the information for this identifier is out of date with respect to the external source.
Definition at line 327 of file IdentifierTable.h.
Referenced by clang::ASTReader::markIdentifierUpToDate().
|
friend |
Definition at line 83 of file IdentifierTable.h.