diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
| commit | 9f4dbff6669c8037f3b036bcf580d14f1a4f12a5 (patch) | |
| tree | 47df2c12b57214af6c31e47404b005675b8b7ffc /lib/Sema/IdentifierResolver.cpp | |
| parent | f73d5f23a889b93d89ddef61ac0995df40286bb8 (diff) | |
Notes
Diffstat (limited to 'lib/Sema/IdentifierResolver.cpp')
| -rw-r--r-- | lib/Sema/IdentifierResolver.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/Sema/IdentifierResolver.cpp b/lib/Sema/IdentifierResolver.cpp index 6e354b9060e3..2a5bacff0d93 100644 --- a/lib/Sema/IdentifierResolver.cpp +++ b/lib/Sema/IdentifierResolver.cpp @@ -45,7 +45,7 @@ class IdentifierResolver::IdDeclInfoMap { unsigned int CurIndex; public: - IdDeclInfoMap() : CurPool(0), CurIndex(POOL_SIZE) {} + IdDeclInfoMap() : CurPool(nullptr), CurIndex(POOL_SIZE) {} ~IdDeclInfoMap() { IdDeclInfoPool *Cur = CurPool; @@ -95,7 +95,7 @@ IdentifierResolver::~IdentifierResolver() { /// if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns /// true if 'D' belongs to the given declaration context. bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx, Scope *S, - bool ExplicitInstantiationOrSpecialization) const { + bool AllowInlineNamespace) const { Ctx = Ctx->getRedeclContext(); if (Ctx->isFunctionOrMethod() || S->isFunctionPrototypeScope()) { @@ -131,9 +131,8 @@ bool IdentifierResolver::isDeclInScope(Decl *D, DeclContext *Ctx, Scope *S, } DeclContext *DCtx = D->getDeclContext()->getRedeclContext(); - return ExplicitInstantiationOrSpecialization - ? Ctx->InEnclosingNamespaceSetOf(DCtx) - : Ctx->Equals(DCtx); + return AllowInlineNamespace ? Ctx->InEnclosingNamespaceSetOf(DCtx) + : Ctx->Equals(DCtx); } /// AddDecl - Link the decl to its shadowed decl chain. @@ -152,7 +151,7 @@ void IdentifierResolver::AddDecl(NamedDecl *D) { IdDeclInfo *IDI; if (isDeclPtr(Ptr)) { - Name.setFETokenInfo(NULL); + Name.setFETokenInfo(nullptr); IDI = &(*IdDeclInfos)[Name]; NamedDecl *PrevD = static_cast<NamedDecl*>(Ptr); IDI->AddDecl(PrevD); @@ -214,7 +213,7 @@ void IdentifierResolver::RemoveDecl(NamedDecl *D) { if (isDeclPtr(Ptr)) { assert(D == Ptr && "Didn't find this decl on its identifier's chain!"); - Name.setFETokenInfo(NULL); + Name.setFETokenInfo(nullptr); return; } @@ -274,10 +273,8 @@ static DeclMatchKind compareDeclarations(NamedDecl *Existing, NamedDecl *New) { // If the existing declaration is somewhere in the previous declaration // chain of the new declaration, then prefer the new declaration. - for (Decl::redecl_iterator RD = New->redecls_begin(), - RDEnd = New->redecls_end(); - RD != RDEnd; ++RD) { - if (*RD == Existing) + for (auto RD : New->redecls()) { + if (RD == Existing) return DMK_Replace; if (RD->isCanonicalDecl()) @@ -317,8 +314,8 @@ bool IdentifierResolver::tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name){ Name.setFETokenInfo(D); return true; } - - Name.setFETokenInfo(NULL); + + Name.setFETokenInfo(nullptr); IDI = &(*IdDeclInfos)[Name]; // If the existing declaration is not visible in translation unit scope, |
