summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-03-07 13:44:44 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-03-07 13:44:44 +0000
commit63ab760ebe0dadb44c055b75177eae57286e568a (patch)
treed6052ae7189cef4813c27148c663f62b3636346c /clang
parent18adbc361a0e97a49960f0261dd98075584271fc (diff)
downloadbcm5719-llvm-63ab760ebe0dadb44c055b75177eae57286e568a.tar.gz
bcm5719-llvm-63ab760ebe0dadb44c055b75177eae57286e568a.zip
[C++11] Updating getUsingDirectives to use iterator_range instead of a std::pair.
llvm-svn: 203239
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/DeclBase.h8
-rw-r--r--clang/lib/AST/DeclBase.cpp4
-rw-r--r--clang/lib/Sema/SemaLookup.cpp13
3 files changed, 11 insertions, 14 deletions
diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h
index d281f19df88..8be3b8c81a3 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/include/clang/AST/DeclBase.h
@@ -1575,16 +1575,16 @@ public:
/// within this context.
typedef UsingDirectiveDecl * const * udir_iterator;
- typedef std::pair<udir_iterator, udir_iterator> udir_iterator_range;
+ typedef llvm::iterator_range<udir_iterator> udir_range;
- udir_iterator_range getUsingDirectives() const;
+ udir_range getUsingDirectives() const;
udir_iterator using_directives_begin() const {
- return getUsingDirectives().first;
+ return getUsingDirectives().begin();
}
udir_iterator using_directives_end() const {
- return getUsingDirectives().second;
+ return getUsingDirectives().end();
}
// These are all defined in DependentDiagnostic.h.
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index 00692df46c5..2c4df114755 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -1528,12 +1528,12 @@ void DeclContext::makeDeclVisibleInContextImpl(NamedDecl *D, bool Internal) {
/// Returns iterator range [First, Last) of UsingDirectiveDecls stored within
/// this context.
-DeclContext::udir_iterator_range
+DeclContext::udir_range
DeclContext::getUsingDirectives() 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_iterator_range(reinterpret_cast<udir_iterator>(Result.begin()),
+ return udir_range(reinterpret_cast<udir_iterator>(Result.begin()),
reinterpret_cast<udir_iterator>(Result.end()));
}
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 059bc1cae73..5c66f077c82 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -153,9 +153,7 @@ namespace {
void addUsingDirectives(DeclContext *DC, DeclContext *EffectiveDC) {
SmallVector<DeclContext*,4> queue;
while (true) {
- DeclContext::udir_iterator I, End;
- for (std::tie(I, End) = DC->getUsingDirectives(); I != End; ++I) {
- UsingDirectiveDecl *UD = *I;
+ for (auto UD : DC->getUsingDirectives()) {
DeclContext *NS = UD->getNominatedNamespace();
if (visited.insert(NS)) {
addUsingDirective(UD, EffectiveDC);
@@ -1515,8 +1513,8 @@ static bool LookupQualifiedNameInUsingDirectives(Sema &S, LookupResult &R,
continue;
}
- for (std::tie(I, E) = ND->getUsingDirectives(); I != E; ++I) {
- NamespaceDecl *Nom = (*I)->getNominatedNamespace();
+ for (auto I : ND->getUsingDirectives()) {
+ NamespaceDecl *Nom = I->getNominatedNamespace();
if (Visited.insert(Nom))
Queue.push_back(Nom);
}
@@ -3085,9 +3083,8 @@ static void LookupVisibleDecls(DeclContext *Ctx, LookupResult &Result,
// Traverse using directives for qualified name lookup.
if (QualifiedNameLookup) {
ShadowContextRAII Shadow(Visited);
- DeclContext::udir_iterator I, E;
- for (std::tie(I, E) = Ctx->getUsingDirectives(); I != E; ++I) {
- LookupVisibleDecls((*I)->getNominatedNamespace(), Result,
+ for (auto I : Ctx->getUsingDirectives()) {
+ LookupVisibleDecls(I->getNominatedNamespace(), Result,
QualifiedNameLookup, InBaseClass, Consumer, Visited);
}
}
OpenPOWER on IntegriCloud