aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-07-17 17:49:50 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-07-17 17:49:50 +0000
commit90eb539bc3121bdc0e867ab1cd6bdca3b36d961e (patch)
tree709cd176611f6f3980490c9ca8155e2bc34f91ca /lib/Sema/SemaDecl.cpp
parentf616ebb9b61239182a2ebc29bf3bd4f80530daab (diff)
Unify ctx_iterator/ctx_begin()/ctx_end() and iterator/begin()/end() so that a single iterator type is used for both traversing decls of the same declaration context *and* of the parent declaration contexts, depending on the value of the bool parameter 'LookInParentCtx' that is passed to IdentifierResolver::begin().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53724 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 6acbb2d184..e2ac7c5ea5 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -91,15 +91,16 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S) {
// in this case the class name or enumeration name is hidden.
if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
// We are pushing the name of a tag (enum or class).
- IdentifierResolver::ctx_iterator
- CIT = IdResolver.ctx_begin(TD->getIdentifier(), TD->getDeclContext());
- if (CIT != IdResolver.ctx_end(TD->getIdentifier()) &&
- IdResolver.isDeclInScope(*CIT, TD->getDeclContext(), S)) {
+ IdentifierResolver::iterator
+ I = IdResolver.begin(TD->getIdentifier(),
+ TD->getDeclContext(), false/*LookInParentCtx*/);
+ if (I != IdResolver.end() &&
+ IdResolver.isDeclInScope(*I, TD->getDeclContext(), S)) {
// There is already a declaration with the same name in the same
// scope. It must be found before we find the new declaration,
// so swap the order on the shadowed declaration chain.
- IdResolver.AddShadowedDecl(TD, *CIT);
+ IdResolver.AddShadowedDecl(TD, *I);
return;
}
}
@@ -158,7 +159,7 @@ Decl *Sema::LookupDecl(const IdentifierInfo *II, unsigned NSI,
// that is in the appropriate namespace. This search should not take long, as
// shadowing of names is uncommon, and deep shadowing is extremely uncommon.
for (IdentifierResolver::iterator
- I = IdResolver.begin(II, CurContext), E = IdResolver.end(II); I != E; ++I)
+ I = IdResolver.begin(II, CurContext), E = IdResolver.end(); I != E; ++I)
if ((*I)->getIdentifierNamespace() & NS)
return *I;