;
37 static const unsigned intPOOL_SIZE = 512;
42 structIdDeclInfoPool {
44IdDeclInfo Pool[POOL_SIZE];
46IdDeclInfoPool(IdDeclInfoPool *Next) : Next(Next) {}
49IdDeclInfoPool *CurPool =
nullptr;
50 unsigned intCurIndex = POOL_SIZE;
56IdDeclInfoPool *Cur = CurPool;
57 while(IdDeclInfoPool *
P= Cur) {
77voidIdentifierResolver::IdDeclInfo::RemoveDecl(
NamedDecl*
D) {
78 for(DeclsTy::iterator I = Decls.end(); I != Decls.begin(); --I) {
85llvm_unreachable(
"Didn't find this decl on its identifier's chain!");
93: LangOpt(PP.getLangOpts()), PP(PP), IdDeclInfos(new
IdDeclInfoMap) {}
103 boolAllowInlineNamespace)
const{
104Ctx = Ctx->getRedeclContext();
108 if(LangOpt.HLSL && isa<HLSLBufferDecl>(
D))
110 if(Ctx->isFunctionOrMethod() || (S && S->isFunctionPrototypeScope())) {
112 while(S->getEntity() &&
113(S->getEntity()->isTransparentContext() ||
114(!LangOpt.CPlusPlus && isa<RecordDecl>(S->getEntity()))))
117 if(S->isDeclScope(
D))
119 if(LangOpt.CPlusPlus) {
132assert(S->getParent() &&
"No TUScope?");
135 if(S->getParent()->isControlScope() && !S->isFunctionScope()) {
137 if(S->isDeclScope(
D))
140 if(S->isFnTryCatchScope())
141 returnS->getParent()->isDeclScope(
D);
150 returnAllowInlineNamespace ? Ctx->InEnclosingNamespaceSetOf(DCtx)
158updatingIdentifier(*II);
160 void*Ptr = Name.getFETokenInfo();
163Name.setFETokenInfo(
D);
169 if(isDeclPtr(Ptr)) {
170Name.setFETokenInfo(
nullptr);
171IDI = &(*IdDeclInfos)[Name];
175IDI = toIdDeclInfo(Ptr);
183updatingIdentifier(*II);
185 void*Ptr = Name.getFETokenInfo();
192 if(isDeclPtr(Ptr)) {
211IdDeclInfo *IDI = toIdDeclInfo(Ptr);
215IDI->InsertDecl(IDI->decls_begin(),
D);
221assert(
D&&
"null param passed");
224updatingIdentifier(*II);
226 void*Ptr = Name.getFETokenInfo();
228assert(Ptr &&
"Didn't find this decl on its identifier's chain!");
230 if(isDeclPtr(Ptr)) {
231assert(
D== Ptr &&
"Didn't find this decl on its identifier's chain!");
232Name.setFETokenInfo(
nullptr);
236 returntoIdDeclInfo(Ptr)->RemoveDecl(
D);
239llvm::iterator_range<IdentifierResolver::iterator>
246readingIdentifier(*II);
248 void*Ptr = Name.getFETokenInfo();
249 if(!Ptr)
return end();
254IdDeclInfo *IDI = toIdDeclInfo(Ptr);
256IdDeclInfo::DeclsTy::iterator I = IDI->decls_end();
257 if(I != IDI->decls_begin())
283 returnDMK_Different;
290 returnDMK_Different;
294 if(Existing == MostRecent)
297 if(New == MostRecent)
302 for(
auto*RD : New->
redecls()) {
306 if(RD->isCanonicalDecl())
313 returnDMK_Different;
318readingIdentifier(*II);
320 void*Ptr = Name.getFETokenInfo();
323Name.setFETokenInfo(
D);
329 if(isDeclPtr(Ptr)) {
340Name.setFETokenInfo(
D);
344Name.setFETokenInfo(
nullptr);
345IDI = &(*IdDeclInfos)[Name];
359IDI = toIdDeclInfo(Ptr);
363 for(IdDeclInfo::DeclsTy::iterator I = IDI->decls_begin(),
364IEnd = IDI->decls_end();
379 if(!(*I)->getDeclContext()->getRedeclContext()->isTranslationUnit()) {
382IDI->InsertDecl(I,
D);
411IdentifierResolver::IdDeclInfo &
413 void*Ptr = Name.getFETokenInfo();
415 if(Ptr)
return*toIdDeclInfo(Ptr);
417 if(CurIndex == POOL_SIZE) {
418CurPool =
newIdDeclInfoPool(CurPool);
421IdDeclInfo *IDI = &CurPool->Pool[CurIndex];
422Name.setFETokenInfo(
reinterpret_cast<void*
>(
431 void*InfoPtr =
D->getDeclName().getFETokenInfo();
432assert(!isDeclPtr(InfoPtr) &&
"Decl with wrong id ?");
433IdDeclInfo *Info = toIdDeclInfo(InfoPtr);
436 if(I != Info->decls_begin())
static DeclMatchKind compareDeclarations(NamedDecl *Existing, NamedDecl *New)
Compare two declarations to see whether they are different or, if they are the same,...
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Defines the clang::LangOptions interface.
Defines the clang::Preprocessor interface.
IdDeclInfoMap - Associates IdDeclInfos with declaration names.
IdDeclInfoMap(const IdDeclInfoMap &)=delete
IdDeclInfoMap & operator=(const IdDeclInfoMap &)=delete
IdDeclInfo & operator[](DeclarationName Name)
Returns the IdDeclInfo associated to the DeclarationName.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isTranslationUnit() const
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
Decl - This represents one declaration (or definition), e.g.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
DeclContext * getDeclContext()
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
The name of a declaration.
virtual void updateOutOfDateIdentifier(const IdentifierInfo &II)=0
Update an out-of-date identifier.
One of these records is kept for each identifier that is lexed.
bool isFromAST() const
Return true if the identifier in its current state was loaded from an AST file.
void setFETokenInfoChangedSinceDeserialization()
Note that the frontend token information for this identifier has changed since it was loaded from an ...
bool isOutOfDate() const
Determine whether the information for this identifier is out of date with respect to the external sou...
iterator - Iterate over the decls of a specified declaration name.
IdDeclInfo::DeclsTy::iterator BaseIter
BaseIter getIterator() const
iterator begin(DeclarationName Name)
Returns an iterator over decls with the name 'Name'.
void RemoveDecl(NamedDecl *D)
RemoveDecl - Unlink the decl from its shadowed decl chain.
IdentifierResolver(Preprocessor &PP)
void InsertDeclAfter(iterator Pos, NamedDecl *D)
Insert the given declaration after the given iterator position.
bool tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name)
Try to add the given declaration to the top level scope, if it (or a redeclaration of it) hasn't alre...
iterator end()
Returns the end iterator.
void AddDecl(NamedDecl *D)
AddDecl - Link the decl to its shadowed decl chain.
llvm::iterator_range< iterator > decls(DeclarationName Name)
Returns a range of decls with the name 'Name'.
bool isDeclInScope(Decl *D, DeclContext *Ctx, Scope *S=nullptr, bool AllowInlineNamespace=false) const
isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true if 'D' is in Scope 'S',...
This represents a decl that may have a name.
NamedDecl * getMostRecentDecl()
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
ExternalPreprocessorSource * getExternalSource() const
Scope - A scope is a transient data structure that is used while parsing the program.
The JSON file list parser is used to communicate input to InstallAPI.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
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