本文整理汇总了C++中IdDeclInfo类的典型用法代码示例。如果您正苦于以下问题:C++ IdDeclInfo类的具体用法?C++ IdDeclInfo怎么用?C++ IdDeclInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IdDeclInfo类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updatingIdentifier
/// AddDecl - Link the decl to its shadowed decl chain.
void IdentifierResolver::AddDecl(NamedDecl *D) {
DeclarationName Name = D->getDeclName();
if (IdentifierInfo *II = Name.getAsIdentifierInfo()) {
updatingIdentifier(*II);
//@@
if (II->isMetaGenerated()) return;
//@@
}
void *Ptr = Name.getFETokenInfo<void>();
if (!Ptr) {
Name.setFETokenInfo(D);
return;
}
IdDeclInfo *IDI;
if (isDeclPtr(Ptr)) {
Name.setFETokenInfo(nullptr);
IDI = &(*IdDeclInfos)[Name];
NamedDecl *PrevD = static_cast<NamedDecl*>(Ptr);
IDI->AddDecl(PrevD);
} else
IDI = toIdDeclInfo(Ptr);
IDI->AddDecl(D);
}
示例2: assert
void IdentifierResolver::iterator::incrementSlowCase() {
NamedDecl *D = **this;
void *InfoPtr = D->getDeclName().getFETokenInfo<void>();
assert(!isDeclPtr(InfoPtr) && "Decl with wrong id ?");
IdDeclInfo *Info = toIdDeclInfo(InfoPtr);
BaseIter I = getIterator();
if (I != Info->decls_begin())
*this = iterator(I-1);
else // No more decls.
*this = iterator();
}
示例3: iterator
/// begin - Returns an iterator for decls with name 'Name'.
IdentifierResolver::iterator
IdentifierResolver::begin(DeclarationName Name) {
void *Ptr = Name.getFETokenInfo<void>();
if (!Ptr) return end();
if (isDeclPtr(Ptr))
return iterator(static_cast<NamedDecl*>(Ptr));
IdDeclInfo *IDI = toIdDeclInfo(Ptr);
IdDeclInfo::DeclsTy::iterator I = IDI->decls_end();
if (I != IDI->decls_begin())
return iterator(I-1);
// No decls found.
return end();
}
示例4: updatingIdentifier
void IdentifierResolver::InsertDeclAfter(iterator Pos, NamedDecl *D) {
DeclarationName Name = D->getDeclName();
if (IdentifierInfo *II = Name.getAsIdentifierInfo())
updatingIdentifier(*II);
void *Ptr = Name.getFETokenInfo<void>();
if (!Ptr) {
AddDecl(D);
return;
}
if (isDeclPtr(Ptr)) {
// We only have a single declaration: insert before or after it,
// as appropriate.
if (Pos == iterator()) {
// Add the new declaration before the existing declaration.
NamedDecl *PrevD = static_cast<NamedDecl*>(Ptr);
RemoveDecl(PrevD);
AddDecl(D);
AddDecl(PrevD);
} else {
// Add new declaration after the existing declaration.
AddDecl(D);
}
return;
}
if (IdentifierInfo *II = Name.getAsIdentifierInfo())
if (II->isFromAST())
II->setChangedSinceDeserialization();
// General case: insert the declaration at the appropriate point in the
// list, which already has at least two elements.
IdDeclInfo *IDI = toIdDeclInfo(Ptr);
if (Pos.isIterator()) {
IDI->InsertDecl(Pos.getIterator() + 1, D);
} else
IDI->InsertDecl(IDI->decls_begin(), D);
}
示例5: toIdDeclInfo
void IdentifierResolver::AddDeclToIdentifierChain(IdentifierInfo *II,
NamedDecl *D) {
void *Ptr = II->getFETokenInfo<void>();
if (!Ptr) {
II->setFETokenInfo(D);
return;
}
IdDeclInfo *IDI;
if (isDeclPtr(Ptr)) {
II->setFETokenInfo(NULL);
IDI = &(*IdDeclInfos)[II];
NamedDecl *PrevD = static_cast<NamedDecl*>(Ptr);
IDI->AddDecl(PrevD);
} else
IDI = toIdDeclInfo(Ptr);
IDI->AddDecl(D);
}
示例6: assert
/// AddShadowedDecl - Link the decl to its shadowed decl chain putting it
/// after the decl that the iterator points to, thus the 'Shadow' decl will be
/// encountered before the 'D' decl.
void IdentifierResolver::AddShadowedDecl(NamedDecl *D, NamedDecl *Shadow) {
assert(D->getDeclName() == Shadow->getDeclName() && "Different ids!");
DeclarationName Name = D->getDeclName();
void *Ptr = Name.getFETokenInfo<void>();
assert(Ptr && "No decl from Ptr ?");
IdDeclInfo *IDI;
if (isDeclPtr(Ptr)) {
Name.setFETokenInfo(NULL);
IDI = &(*IdDeclInfos)[Name];
NamedDecl *PrevD = static_cast<NamedDecl*>(Ptr);
assert(PrevD == Shadow && "Invalid shadow decl ?");
IDI->AddDecl(D);
IDI->AddDecl(PrevD);
return;
}
IDI = toIdDeclInfo(Ptr);
IDI->AddShadowed(D, Shadow);
}
示例7: readingIdentifier
/// begin - Returns an iterator for decls with name 'Name'.
IdentifierResolver::iterator
IdentifierResolver::begin(DeclarationName Name) {
if (IdentifierInfo *II = Name.getAsIdentifierInfo()) {
readingIdentifier(*II);
//@@
if (II->isMetaGenerated()) return end();
//@@
}
void *Ptr = Name.getFETokenInfo<void>();
if (!Ptr) return end();
if (isDeclPtr(Ptr))
return iterator(static_cast<NamedDecl*>(Ptr));
IdDeclInfo *IDI = toIdDeclInfo(Ptr);
IdDeclInfo::DeclsTy::iterator I = IDI->decls_end();
if (I != IDI->decls_begin())
return iterator(I-1);
// No decls found.
return end();
}
示例8: readingIdentifier
bool IdentifierResolver::tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name){
if (IdentifierInfo *II = Name.getAsIdentifierInfo())
readingIdentifier(*II);
void *Ptr = Name.getFETokenInfo<void>();
if (!Ptr) {
Name.setFETokenInfo(D);
return true;
}
IdDeclInfo *IDI;
if (isDeclPtr(Ptr)) {
NamedDecl *PrevD = static_cast<NamedDecl*>(Ptr);
switch (compareDeclarations(PrevD, D)) {
case DMK_Different:
break;
case DMK_Ignore:
return false;
case DMK_Replace:
Name.setFETokenInfo(D);
return true;
}
Name.setFETokenInfo(nullptr);
IDI = &(*IdDeclInfos)[Name];
// If the existing declaration is not visible in translation unit scope,
// then add the new top-level declaration first.
if (!PrevD->getDeclContext()->getRedeclContext()->isTranslationUnit()) {
IDI->AddDecl(D);
IDI->AddDecl(PrevD);
} else {
IDI->AddDecl(PrevD);
IDI->AddDecl(D);
}
return true;
}
IDI = toIdDeclInfo(Ptr);
// See whether this declaration is identical to any existing declarations.
// If not, find the right place to insert it.
for (IdDeclInfo::DeclsTy::iterator I = IDI->decls_begin(),
IEnd = IDI->decls_end();
I != IEnd; ++I) {
switch (compareDeclarations(*I, D)) {
case DMK_Different:
break;
case DMK_Ignore:
return false;
case DMK_Replace:
*I = D;
return true;
}
if (!(*I)->getDeclContext()->getRedeclContext()->isTranslationUnit()) {
// We've found a declaration that is not visible from the translation
// unit (it's in an inner scope). Insert our declaration here.
IDI->InsertDecl(I, D);
return true;
}
}
// Add the declaration to the end.
IDI->AddDecl(D);
return true;
}