diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/DeclBase.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 16 |
2 files changed, 11 insertions, 13 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index c95a64aa2e9..d4c8235f8a8 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -1523,13 +1523,13 @@ void DeclContext::makeDeclVisibleInContextImpl(NamedDecl *D, bool Internal) { /// Returns iterator range [First, Last) of UsingDirectiveDecls stored within /// this context. -DeclContext::udir_range -DeclContext::getUsingDirectives() const { +DeclContext::udir_range DeclContext::using_directives() const { // FIXME: Use something more efficient than normal lookup for using // directives. In C++, using directives are looked up more than anything else. lookup_const_result Result = lookup(UsingDirectiveDecl::getName()); - return udir_range(reinterpret_cast<udir_iterator>(Result.begin()), - reinterpret_cast<udir_iterator>(Result.end())); + return udir_range( + reinterpret_cast<UsingDirectiveDecl *const *>(Result.begin()), + reinterpret_cast<UsingDirectiveDecl *const *>(Result.end())); } //===----------------------------------------------------------------------===// diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 29671aa65d4..42c9acbdd80 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -151,7 +151,7 @@ namespace { void addUsingDirectives(DeclContext *DC, DeclContext *EffectiveDC) { SmallVector<DeclContext*,4> queue; while (true) { - for (auto UD : DC->getUsingDirectives()) { + for (auto UD : DC->using_directives()) { DeclContext *NS = UD->getNominatedNamespace(); if (visited.insert(NS)) { addUsingDirective(UD, EffectiveDC); @@ -1448,10 +1448,8 @@ static bool LookupQualifiedNameInUsingDirectives(Sema &S, LookupResult &R, DeclContext *StartDC) { assert(StartDC->isFileContext() && "start context is not a file context"); - DeclContext::udir_iterator I = StartDC->using_directives_begin(); - DeclContext::udir_iterator E = StartDC->using_directives_end(); - - if (I == E) return false; + DeclContext::udir_range UsingDirectives = StartDC->using_directives(); + if (UsingDirectives.begin() == UsingDirectives.end()) return false; // We have at least added all these contexts to the queue. llvm::SmallPtrSet<DeclContext*, 8> Visited; @@ -1463,8 +1461,8 @@ static bool LookupQualifiedNameInUsingDirectives(Sema &S, LookupResult &R, // We have already looked into the initial namespace; seed the queue // with its using-children. - for (; I != E; ++I) { - NamespaceDecl *ND = (*I)->getNominatedNamespace()->getOriginalNamespace(); + for (auto *I : UsingDirectives) { + NamespaceDecl *ND = I->getNominatedNamespace()->getOriginalNamespace(); if (Visited.insert(ND)) Queue.push_back(ND); } @@ -1511,7 +1509,7 @@ static bool LookupQualifiedNameInUsingDirectives(Sema &S, LookupResult &R, continue; } - for (auto I : ND->getUsingDirectives()) { + for (auto I : ND->using_directives()) { NamespaceDecl *Nom = I->getNominatedNamespace(); if (Visited.insert(Nom)) Queue.push_back(Nom); @@ -3074,7 +3072,7 @@ static void LookupVisibleDecls(DeclContext *Ctx, LookupResult &Result, // Traverse using directives for qualified name lookup. if (QualifiedNameLookup) { ShadowContextRAII Shadow(Visited); - for (auto I : Ctx->getUsingDirectives()) { + for (auto I : Ctx->using_directives()) { LookupVisibleDecls(I->getNominatedNamespace(), Result, QualifiedNameLookup, InBaseClass, Consumer, Visited); } |