diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-03-15 15:26:48 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-03-15 15:26:48 +0000 |
| commit | ea16606fcd0b097e6cd5e0349f6bb533744e78f2 (patch) | |
| tree | 04523034850bba8850b65f82d5de99051c161cdc /clang/lib/Sema/SemaLookup.cpp | |
| parent | 6623006249cbeffd7f4f651099f99d51fbd62a50 (diff) | |
| download | bcm5719-llvm-ea16606fcd0b097e6cd5e0349f6bb533744e78f2.tar.gz bcm5719-llvm-ea16606fcd0b097e6cd5e0349f6bb533744e78f2.zip | |
During C++ name lookup, use DeclContext::Equals() rather than
comparing DeclContext pointers, to avoid having to remember to call
getPrimaryContext() everywhere. This is the last part PR6594.
llvm-svn: 98546
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 615f2f1d84c..6caeec620d0 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -603,8 +603,7 @@ static std::pair<DeclContext *, bool> findOuterContext(Scope *S) { for (Scope *OuterS = S->getParent(); OuterS; OuterS = OuterS->getParent()) { if (OuterS->getEntity()) { - Lexical - = static_cast<DeclContext *>(OuterS->getEntity())->getPrimaryContext(); + Lexical = static_cast<DeclContext *>(OuterS->getEntity()); break; } } @@ -722,8 +721,7 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) { if (SearchAfterTemplateScope) OutsideOfTemplateParamDC = OuterCtx; - for (; Ctx && Ctx->getPrimaryContext() != OuterCtx; - Ctx = Ctx->getLookupParent()) { + for (; Ctx && !Ctx->Equals(OuterCtx); Ctx = Ctx->getLookupParent()) { // We do not directly look into transparent contexts, since // those entities will be found in the nearest enclosing // non-transparent context. @@ -2307,7 +2305,7 @@ static void LookupVisibleDecls(Scope *S, LookupResult &Result, Entity = (DeclContext *)S->getEntity(); DeclContext *OuterCtx = findOuterContext(S).first; // FIXME - for (DeclContext *Ctx = Entity; Ctx && Ctx->getPrimaryContext() != OuterCtx; + for (DeclContext *Ctx = Entity; Ctx && !Ctx->Equals(OuterCtx); Ctx = Ctx->getLookupParent()) { if (ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(Ctx)) { if (Method->isInstanceMethod()) { |

