DeclarationNameTable;
45classMultiKeywordSelector;
95#define OBJC_AT_KEYWORD(X) objc_##X, 96#include "clang/Basic/TokenKinds.def" 99#define NOTABLE_IDENTIFIER(X) X, 100#include "clang/Basic/TokenKinds.def" 104#define BUILTIN(ID, TYPE, ATTRS) BI##ID, 105#include "clang/Basic/Builtins.inc" 122 unsignedTokenID : 9;
128LLVM_PREFERRED_TYPE(
bool)
129 unsignedHasMacro : 1;
132LLVM_PREFERRED_TYPE(
bool)
133 unsignedHadMacro : 1;
136LLVM_PREFERRED_TYPE(
bool)
137 unsignedIsExtension : 1;
140LLVM_PREFERRED_TYPE(
bool)
141 unsignedIsFutureCompatKeyword : 1;
144LLVM_PREFERRED_TYPE(
bool)
145 unsignedIsPoisoned : 1;
148LLVM_PREFERRED_TYPE(
bool)
149 unsignedIsCPPOperatorKeyword : 1;
153LLVM_PREFERRED_TYPE(
bool)
154 unsignedNeedsHandleIdentifier : 1;
157LLVM_PREFERRED_TYPE(
bool)
158 unsignedIsFromAST : 1;
162LLVM_PREFERRED_TYPE(
bool)
163 unsignedChangedAfterLoad : 1;
167LLVM_PREFERRED_TYPE(
bool)
168 unsignedFEChangedAfterLoad : 1;
171LLVM_PREFERRED_TYPE(
bool)
172 unsignedRevertedTokenID : 1;
176LLVM_PREFERRED_TYPE(
bool)
177 unsignedOutOfDate : 1;
180LLVM_PREFERRED_TYPE(
bool)
181 unsignedIsModulesImport : 1;
184LLVM_PREFERRED_TYPE(
bool)
185 unsignedIsMangledOpenMPVariantName : 1;
188LLVM_PREFERRED_TYPE(
bool)
189 unsignedIsDeprecatedMacro : 1;
192LLVM_PREFERRED_TYPE(
bool)
193 unsignedIsRestrictExpansion : 1;
196LLVM_PREFERRED_TYPE(
bool)
197 unsignedIsFinal : 1;
202 void*FETokenInfo =
nullptr;
204llvm::StringMapEntry<IdentifierInfo *> *Entry =
nullptr;
207: TokenID(tok::identifier),
208InterestingIdentifierID(
llvm::to_underlying(
211IsFutureCompatKeyword(
false), IsPoisoned(
false),
212IsCPPOperatorKeyword(
false), NeedsHandleIdentifier(
false),
213IsFromAST(
false), ChangedAfterLoad(
false), FEChangedAfterLoad(
false),
214RevertedTokenID(
false), OutOfDate(
false), IsModulesImport(
false),
215IsMangledOpenMPVariantName(
false), IsDeprecatedMacro(
false),
216IsRestrictExpansion(
false), IsFinal(
false) {}
227 template<std::
size_tStrLen>
228 bool isStr(
const char(&Str)[StrLen])
const{
229 returngetLength() == StrLen-1 &&
230memcmp(getNameStart(), Str, StrLen-1) == 0;
234 bool isStr(llvm::StringRef Str)
const{
235llvm::StringRef ThisStr(getNameStart(), getLength());
236 returnThisStr == Str;
244 unsigned getLength()
const{
returnEntry->getKeyLength(); }
248 returnStringRef(getNameStart(), getLength());
257 if(HasMacro == Val)
return;
261NeedsHandleIdentifier =
true;
269IsDeprecatedMacro =
false;
270IsRestrictExpansion =
false;
272RecomputeNeedsHandleIdentifier();
285 if(IsDeprecatedMacro == Val)
287IsDeprecatedMacro = Val;
289NeedsHandleIdentifier =
true;
291RecomputeNeedsHandleIdentifier();
297 if(IsRestrictExpansion == Val)
299IsRestrictExpansion = Val;
301NeedsHandleIdentifier =
true;
303RecomputeNeedsHandleIdentifier();
325assert(TokenID != tok::identifier &&
"Already at tok::identifier");
326TokenID = tok::identifier;
327RevertedTokenID =
true;
330assert(TokenID == tok::identifier &&
"Should be at tok::identifier");
332RevertedTokenID =
false;
344assert(0 == llvm::to_underlying(InterestingIdentifier::objc_not_keyword));
346 if(
Value< InterestingIdentifier::NUM_OBJC_KEYWORDS)
348 returntok::objc_not_keyword;
351assert(0 == llvm::to_underlying(InterestingIdentifier::objc_not_keyword));
352InterestingIdentifierID =
ID;
353assert(getObjCKeywordID() ==
ID&&
"ID too large for field!");
360InterestingIdentifier::NUM_OBJC_KEYWORDS_AND_NOTABLE_IDENTIFIERS &&
361 Value!= InterestingIdentifier::NotInterestingIdentifier) {
363llvm::to_underlying(InterestingIdentifier::NotBuiltin);
364 return static_cast<Builtin::ID>(InterestingIdentifierID - FirstBuiltin);
366 returnBuiltin::ID::NotBuiltin;
369assert(
ID!= Builtin::ID::NotBuiltin);
370 autoFirstBuiltin = llvm::to_underlying(InterestingIdentifier::NotBuiltin);
371InterestingIdentifierID =
ID+ FirstBuiltin;
372assert(getBuiltinID() ==
ID&&
"ID too large for field!");
375InterestingIdentifierID =
376llvm::to_underlying(InterestingIdentifier::NotInterestingIdentifier);
381 if(
Value> InterestingIdentifier::NUM_OBJC_KEYWORDS &&
383InterestingIdentifier::NUM_OBJC_KEYWORDS_AND_NOTABLE_IDENTIFIERS) {
384 autoFirstNotableIdentifier =
3851 + llvm::to_underlying(InterestingIdentifier::NUM_OBJC_KEYWORDS);
387FirstNotableIdentifier);
389 returntok::not_notable;
392assert(
ID!= tok::not_notable);
393 autoFirstNotableIdentifier =
3941 + llvm::to_underlying(InterestingIdentifier::NUM_OBJC_KEYWORDS);
395InterestingIdentifierID =
ID+ FirstNotableIdentifier;
396assert(getNotableIdentifierID() ==
ID&&
"ID too large for field!");
409NeedsHandleIdentifier =
true;
411RecomputeNeedsHandleIdentifier();
421IsFutureCompatKeyword = Val;
423NeedsHandleIdentifier =
true;
425RecomputeNeedsHandleIdentifier();
433NeedsHandleIdentifier =
true;
435RecomputeNeedsHandleIdentifier();
444IsCPPOperatorKeyword = Val;
449 boolisKeyword(
const LangOptions&LangOpts)
const;
453 boolisCPlusPlusKeyword(
const LangOptions&LangOpts)
const;
476 returnChangedAfterLoad;
482ChangedAfterLoad =
true;
488 returnFEChangedAfterLoad;
494FEChangedAfterLoad =
true;
506NeedsHandleIdentifier =
true;
508RecomputeNeedsHandleIdentifier();
518NeedsHandleIdentifier =
true;
520RecomputeNeedsHandleIdentifier();
539 return getName().starts_with(
"<#") &&
getName().ends_with(
"#>");
552StringRef deuglifiedName()
const;
554 returngetLength() == 1 && getNameStart()[0] ==
'_';
569 voidRecomputeNeedsHandleIdentifier() {
570NeedsHandleIdentifier = isPoisoned() || hasMacroDefinition() ||
571isExtensionToken() || isFutureCompatKeyword() ||
572isOutOfDate() || isModulesImport();
586: II(II), OldValue(II ? II->isPoisoned() :
false) {
658 usingHashTableTy = llvm::StringMap<IdentifierInfo *, llvm::BumpPtrAllocator>;
659HashTableTy HashTable;
674ExternalLookup = IILookup;
679 returnExternalLookup;
683 returnHashTable.getAllocator();
689 auto&Entry = *HashTable.try_emplace(Name,
nullptr).first;
695 if(ExternalLookup) {
696II = ExternalLookup->
get(Name);
714II.TokenID = TokenCode;
715assert(II.TokenID == (
unsigned) TokenCode &&
"TokenCode too large");
726 auto&Entry = *HashTable.insert(std::make_pair(Name,
nullptr)).first;
741 if(Name ==
"import")
752 unsigned size()
const{
returnHashTable.size(); }
758 voidPrintStats()
const;
884: ExtraKindOrNumArgs(ObjCMultiArgSelector + NumArgs) {}
888 return static_cast<ExtraKind>(ExtraKindOrNumArgs >
890? (
unsigned)ObjCMultiArgSelector
891: ExtraKindOrNumArgs);
897assert(ExtraKindOrNumArgs >= (
unsigned)ObjCMultiArgSelector &&
898 "getNumArgs called but this is not an ObjC selector!");
899 returnExtraKindOrNumArgs - (
unsigned)ObjCMultiArgSelector;
911 publicllvm::FoldingSetNode {
917: DeclarationNameExtra(nKeys) {
918assert((nKeys > 1) &&
"not a multi-keyword selector");
923 for(
unsignedi = 0; i != nKeys; ++i)
930 usingDeclarationNameExtra::getNumArgs;
939 returnkeyword_begin() + getNumArgs();
943assert(i < getNumArgs() &&
"getIdentifierInfoForSlot(): illegal index");
944 returnkeyword_begin()[i];
949 ID.AddInteger(NumArgs);
950 for(
unsignedi = 0; i != NumArgs; ++i)
951 ID.AddPointer(ArgTys[i]);
955Profile(
ID, keyword_begin(), getNumArgs());
971 enumIdentifierInfoFlag {
994llvm::PointerIntPair<
995llvm::PointerUnion<const IdentifierInfo *, MultiKeywordSelector *>, 2>
999assert(nArgs < 2 &&
"nArgs not equal to 0/1");
1000InfoPtr.setPointerAndInt(II, nArgs + 1);
1003Selector(MultiKeywordSelector *SI) {
1007InfoPtr.setPointerAndInt(SI, MultiArg & 0b11);
1010 constIdentifierInfo *getAsIdentifierInfo()
const{
1011 returndyn_cast_if_present<const IdentifierInfo *>(InfoPtr.getPointer());
1014MultiKeywordSelector *getMultiKeywordSelector()
const{
1015 returncast<MultiKeywordSelector *>(InfoPtr.getPointer());
1018 unsignedgetIdentifierInfoFlag()
const{
1019 unsignednew_flags = InfoPtr.getInt();
1023 if(isa<MultiKeywordSelector *>(InfoPtr.getPointer()))
1024new_flags |= MultiArg;
1037InfoPtr.setFromOpaqueValue(
reinterpret_cast<void*
>(
V));
1042 returnInfoPtr.getOpaqueValue() == RHS.InfoPtr.getOpaqueValue();
1045 returnInfoPtr.getOpaqueValue() != RHS.InfoPtr.getOpaqueValue();
1051 bool isNull()
const{
returnInfoPtr.getOpaqueValue() ==
nullptr; }
1062 boolisUnarySelector(StringRef Name)
const;
1064 unsignedgetNumArgs()
const;
1079 const IdentifierInfo*getIdentifierInfoForSlot(
unsignedargIndex)
const;
1089StringRef getNameForSlot(
unsignedargIndex)
const;
1096 void print(llvm::raw_ostream &OS)
const;
1098 void dump()
const;
1102 returngetMethodFamilyImpl(*
this);
1106 returngetStringFormatFamilyImpl(*
this);
1147 size_tgetTotalMemory()
const;
1164 staticstd::string getPropertyNameFromSetterSelector(
SelectorSel);
1193 return P.getAsOpaquePtr();
1200 static constexpr intNumLowBitsAvailable = 0;
Defines enum values for all the target-independent builtin functions.
enum clang::sema::@1704::IndirectLocalPathEntry::EntryKind Kind
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Defines the Diagnostic IDs-related interfaces.
static void print(llvm::raw_ostream &OS, const T &V, ASTContext &ASTCtx, QualType Ty)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
static std::string getName(const CallEvent &Call)
Defines the clang::TokenKind enum and support functions.
The name of a declaration.
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine a...
Provides lookups to, and iteration over, IdentiferInfo objects.
virtual ~IdentifierInfoLookup()
virtual IdentifierInfo * get(StringRef Name)=0
Return the IdentifierInfo for the specified named identifier.
One of these records is kept for each identifier that is lexed.
bool isHandleIdentifierCase() const
Return true if the Preprocessor::HandleIdentifier must be called on a token of this identifier.
IdentifierInfo(const IdentifierInfo &)=delete
IdentifierInfo(IdentifierInfo &&)=delete
bool isModulesImport() const
Determine whether this is the contextual keyword import.
void revertIdentifierToTokenID(tok::TokenKind TK)
unsigned getLength() const
Efficiently return the length of this identifier info.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
void setModulesImport(bool I)
Set whether this identifier is the contextual keyword import.
void setNotableIdentifierID(unsigned ID)
void setIsExtensionToken(bool Val)
void setIsRestrictExpansion(bool Val)
void setFETokenInfo(void *T)
bool hasChangedSinceDeserialization() const
Determine whether this identifier has changed since it was loaded from an AST file.
bool isCPlusPlusOperatorKeyword() const
IdentifierInfo & operator=(const IdentifierInfo &)=delete
void setIsDeprecatedMacro(bool Val)
bool hasFETokenInfoChangedSinceDeserialization() const
Determine whether the frontend token information for this identifier has changed since it was loaded ...
void setMangledOpenMPVariantName(bool I)
Set whether this is the mangled name of an OpenMP variant.
tok::TokenKind getTokenID() const
If this is a source-language token (e.g.
bool hadMacroDefinition() const
Returns true if this identifier was #defined to some value at any moment.
void setIsPoisoned(bool Value=true)
setIsPoisoned - Mark this identifier as poisoned.
void setObjCKeywordID(tok::ObjCKeywordKind ID)
void setIsFinal(bool Val)
IdentifierInfo & operator=(IdentifierInfo &&)=delete
bool hasMacroDefinition() const
Return true if this identifier is #defined to some other value.
bool isFromAST() const
Return true if the identifier in its current state was loaded from an AST file.
bool isPoisoned() const
Return true if this token has been poisoned.
bool hasRevertedTokenIDToIdentifier() const
True if revertTokenIDToIdentifier() was called.
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
tok::NotableIdentifierKind getNotableIdentifierID() const
bool isMangledOpenMPVariantName() const
Determine whether this is the mangled name of an OpenMP variant.
void setOutOfDate(bool OOD)
Set whether the information for this identifier is out of date with respect to the external source.
void setHasMacroDefinition(bool Val)
bool isStr(llvm::StringRef Str) const
Return true if this is the identifier for the specified StringRef.
unsigned getObjCOrBuiltinID() const
tok::ObjCKeywordKind getObjCKeywordID() const
Return the Objective-C keyword ID for the this identifier.
void setObjCOrBuiltinID(unsigned ID)
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
bool isEditorPlaceholder() const
Return true if this identifier is an editor placeholder.
void setIsCPlusPlusOperatorKeyword(bool Val=true)
isCPlusPlusOperatorKeyword/setIsCPlusPlusOperatorKeyword controls whether this identifier is a C++ al...
void setBuiltinID(unsigned ID)
void setFETokenInfoChangedSinceDeserialization()
Note that the frontend token information for this identifier has changed since it was loaded from an ...
bool operator<(const IdentifierInfo &RHS) const
Provide less than operator for lexicographical sorting.
void revertTokenIDToIdentifier()
Revert TokenID to tok::identifier; used for GNU libstdc++ 4.2 compatibility.
bool isDeprecatedMacro() const
bool isOutOfDate() const
Determine whether the information for this identifier is out of date with respect to the external sou...
void setIsFutureCompatKeyword(bool Val)
void setChangedSinceDeserialization()
Note that this identifier has changed since it was loaded from an AST file.
void * getFETokenInfo() const
Get and set FETokenInfo.
bool isPlaceholder() const
StringRef getName() const
Return the actual identifier string.
bool isFutureCompatKeyword() const
is/setIsFutureCompatKeyword - Initialize information about whether or not this language token is a ke...
bool isExtensionToken() const
get/setExtension - Initialize information about whether or not this language token is an extension.
bool isRestrictExpansion() const
An iterator that walks over all of the known identifiers in the lookup table.
virtual StringRef Next()=0
Retrieve the next string in the identifier table and advances the iterator for the following string.
IdentifierIterator & operator=(const IdentifierIterator &)=delete
IdentifierIterator(const IdentifierIterator &)=delete
virtual ~IdentifierIterator()
IdentifierIterator()=default
Implements an efficient mapping from strings to IdentifierInfo nodes.
IdentifierInfo & getOwn(StringRef Name)
Gets an IdentifierInfo for the given name without consulting external sources.
iterator find(StringRef Name) const
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
IdentifierInfo & get(StringRef Name, tok::TokenKind TokenCode)
IdentifierInfoLookup * getExternalIdentifierLookup() const
Retrieve the external identifier lookup object, if any.
HashTableTy::const_iterator iterator
HashTableTy::const_iterator const_iterator
llvm::BumpPtrAllocator & getAllocator()
void setExternalIdentifierLookup(IdentifierInfoLookup *IILookup)
Set the external identifier lookup mechanism.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
One of these variable length records is kept for each selector containing more than one keyword.
keyword_iterator keyword_end() const
const IdentifierInfo *const * keyword_iterator
MultiKeywordSelector(unsigned nKeys, const IdentifierInfo **IIV)
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, keyword_iterator ArgTys, unsigned NumArgs)
keyword_iterator keyword_begin() const
const IdentifierInfo * getIdentifierInfoForSlot(unsigned i) const
An RAII object for [un]poisoning an identifier within a scope.
~PoisonIdentifierRAIIObject()
PoisonIdentifierRAIIObject(IdentifierInfo *II, bool NewValue)
This table allows us to fully hide how we implement multi-keyword caching.
SelectorTable(const SelectorTable &)=delete
Selector getNullarySelector(const IdentifierInfo *ID)
Selector getUnarySelector(const IdentifierInfo *ID)
SelectorTable & operator=(const SelectorTable &)=delete
Smart pointer class that efficiently represents Objective-C method names.
Selector()=default
The default ctor should only be used when creating data structures that will contain selectors.
static Selector getEmptyMarker()
static Selector getTombstoneMarker()
void * getAsOpaquePtr() const
bool isKeywordSelector() const
ObjCMethodFamily getMethodFamily() const
Derive the conventional family of this method.
bool operator==(Selector RHS) const
operator==/!= - Indicate whether the specified selectors are identical.
bool isUnarySelector() const
bool operator!=(Selector RHS) const
bool isNull() const
Determine whether this is the empty selector.
ObjCStringFormatFamily getStringFormatFamily() const
NotableIdentifierKind
Provides a namespace for notable identifers such as float_t and double_t.
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
PPKeywordKind
Provides a namespace for preprocessor keywords which start with a '#' at the beginning of the line.
The JSON file list parser is used to communicate input to InstallAPI.
@ InvalidObjCMethodFamily
bool isReservedInAllContexts(ReservedIdentifierStatus Status)
Determine whether an identifier is reserved in all contexts.
InterestingIdentifier
The "layout" of InterestingIdentifier is:
@ NUM_OBJC_KEYWORDS_AND_NOTABLE_IDENTIFIERS
@ NotInterestingIdentifier
@ ObjCMethodFamilyBitWidth
ObjCMethodFamily
A family of Objective-C methods.
@ OMF_None
No particular method family.
ObjCInstanceTypeFamily
A family of Objective-C methods.
ReservedLiteralSuffixIdStatus
@ NotStartsWithUnderscore
static constexpr int InterestingIdentifierBits
const FunctionProtoType * T
bool isReservedAtGlobalScope(ReservedIdentifierStatus Status)
Determine whether an identifier is reserved for use as a name at global scope.
@ IdentifierInfoAlignment
llvm::StringRef getAsString(SyncScope S)
std::pair< IdentifierInfo *, SourceLocation > IdentifierLocPair
A simple pair of identifier info and location.
@ StartsWithDoubleUnderscore
@ StartsWithUnderscoreFollowedByCapitalLetter
@ ContainsDoubleUnderscore
@ StartsWithUnderscoreAtGlobalScope
@ StartsWithUnderscoreAndIsExternC
Diagnostic wrappers for TextAPI types for error reporting.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
static clang::Selector getEmptyKey()
static bool isEqual(clang::Selector LHS, clang::Selector RHS)
static clang::Selector getTombstoneKey()
static clang::Selector getFromVoidPointer(const void *P)
static const void * getAsVoidPointer(clang::Selector P)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4