summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/IdentifierResolver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/IdentifierResolver.cpp')
-rw-r--r--clang/lib/Sema/IdentifierResolver.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/clang/lib/Sema/IdentifierResolver.cpp b/clang/lib/Sema/IdentifierResolver.cpp
index dbd52dee1ee..dba56931d49 100644
--- a/clang/lib/Sema/IdentifierResolver.cpp
+++ b/clang/lib/Sema/IdentifierResolver.cpp
@@ -46,7 +46,7 @@ class IdentifierResolver::IdDeclInfoMap {
IdDeclInfoPool(IdDeclInfoPool *Next) : Next(Next) {}
};
-
+
IdDeclInfoPool *CurPool = nullptr;
unsigned int CurIndex = POOL_SIZE;
@@ -171,9 +171,9 @@ 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;
@@ -196,7 +196,7 @@ void IdentifierResolver::InsertDeclAfter(iterator Pos, NamedDecl *D) {
return;
}
- // General case: insert the declaration at the appropriate point in the
+ // 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()) {
@@ -231,7 +231,7 @@ IdentifierResolver::iterator
IdentifierResolver::begin(DeclarationName Name) {
if (IdentifierInfo *II = Name.getAsIdentifierInfo())
readingIdentifier(*II);
-
+
void *Ptr = Name.getFETokenInfo<void>();
if (!Ptr) return end();
@@ -258,7 +258,7 @@ enum DeclMatchKind {
} // namespace
/// Compare two declarations to see whether they are different or,
-/// if they are the same, whether the new declaration should replace the
+/// if they are the same, whether the new declaration should replace the
/// existing declaration.
static DeclMatchKind compareDeclarations(NamedDecl *Existing, NamedDecl *New) {
// If the declarations are identical, ignore the new one.
@@ -289,40 +289,40 @@ static DeclMatchKind compareDeclarations(NamedDecl *Existing, NamedDecl *New) {
for (auto RD : New->redecls()) {
if (RD == Existing)
return DMK_Replace;
-
+
if (RD->isCanonicalDecl())
break;
}
-
+
return DMK_Ignore;
}
-
+
return DMK_Different;
}
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;
@@ -330,7 +330,7 @@ bool IdentifierResolver::tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name){
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()) {
@@ -341,28 +341,28 @@ bool IdentifierResolver::tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name){
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(),
+ 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.
@@ -370,7 +370,7 @@ bool IdentifierResolver::tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name){
return true;
}
}
-
+
// Add the declaration to the end.
IDI->AddDecl(D);
return true;
@@ -378,13 +378,13 @@ bool IdentifierResolver::tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name){
void IdentifierResolver::readingIdentifier(IdentifierInfo &II) {
if (II.isOutOfDate())
- PP.getExternalSource()->updateOutOfDateIdentifier(II);
+ PP.getExternalSource()->updateOutOfDateIdentifier(II);
}
void IdentifierResolver::updatingIdentifier(IdentifierInfo &II) {
if (II.isOutOfDate())
PP.getExternalSource()->updateOutOfDateIdentifier(II);
-
+
if (II.isFromAST())
II.setFETokenInfoChangedSinceDeserialization();
}
OpenPOWER on IntegriCloud