summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-02-06 17:25:10 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-02-06 17:25:10 +0000
commitb4ef66832dee03a992c0424c4c6aa115bdefdbb6 (patch)
tree9e9f696f3c0cfc35a8ede24006cd10a29b482ea4 /clang/lib/AST
parent808141c2af4ba3de2e1d2df946eab36a317bb611 (diff)
downloadbcm5719-llvm-b4ef66832dee03a992c0424c4c6aa115bdefdbb6.tar.gz
bcm5719-llvm-b4ef66832dee03a992c0424c4c6aa115bdefdbb6.zip
Update APIs that return a pair of iterators to return an iterator_range instead.
Convert uses of those APIs into ranged for loops. NFC. llvm-svn: 228404
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/CXXInheritance.cpp20
-rw-r--r--clang/lib/AST/DeclCXX.cpp4
2 files changed, 10 insertions, 14 deletions
diff --git a/clang/lib/AST/CXXInheritance.cpp b/clang/lib/AST/CXXInheritance.cpp
index 6e80ee7c28a..3011e0cdd97 100644
--- a/clang/lib/AST/CXXInheritance.cpp
+++ b/clang/lib/AST/CXXInheritance.cpp
@@ -569,18 +569,14 @@ void FinalOverriderCollector::Collect(const CXXRecordDecl *RD,
// overrider. To do so, we dig down to the original virtual
// functions using data recursion and update all of the methods it
// overrides.
- typedef std::pair<CXXMethodDecl::method_iterator,
- CXXMethodDecl::method_iterator> OverriddenMethods;
+ typedef llvm::iterator_range<CXXMethodDecl::method_iterator>
+ OverriddenMethods;
SmallVector<OverriddenMethods, 4> Stack;
- Stack.push_back(std::make_pair(CanonM->begin_overridden_methods(),
- CanonM->end_overridden_methods()));
+ Stack.push_back(llvm::make_range(CanonM->begin_overridden_methods(),
+ CanonM->end_overridden_methods()));
while (!Stack.empty()) {
- OverriddenMethods OverMethods = Stack.back();
- Stack.pop_back();
-
- for (; OverMethods.first != OverMethods.second; ++OverMethods.first) {
- const CXXMethodDecl *CanonOM
- = cast<CXXMethodDecl>((*OverMethods.first)->getCanonicalDecl());
+ for (const CXXMethodDecl *OM : Stack.pop_back_val()) {
+ const CXXMethodDecl *CanonOM = OM->getCanonicalDecl();
// C++ [class.virtual]p2:
// A virtual member function C::vf of a class object S is
@@ -601,8 +597,8 @@ void FinalOverriderCollector::Collect(const CXXRecordDecl *RD,
// Continue recursion to the methods that this virtual method
// overrides.
- Stack.push_back(std::make_pair(CanonOM->begin_overridden_methods(),
- CanonOM->end_overridden_methods()));
+ Stack.push_back(llvm::make_range(CanonOM->begin_overridden_methods(),
+ CanonOM->end_overridden_methods()));
}
}
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 9af8c4b242a..a796e0b622f 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -1173,7 +1173,7 @@ static void CollectVisibleConversions(ASTContext &Context,
/// getVisibleConversionFunctions - get all conversion functions visible
/// in current class; including conversion function templates.
-std::pair<CXXRecordDecl::conversion_iterator,CXXRecordDecl::conversion_iterator>
+llvm::iterator_range<CXXRecordDecl::conversion_iterator>
CXXRecordDecl::getVisibleConversionFunctions() {
ASTContext &Ctx = getASTContext();
@@ -1189,7 +1189,7 @@ CXXRecordDecl::getVisibleConversionFunctions() {
data().ComputedVisibleConversions = true;
}
}
- return std::make_pair(Set->begin(), Set->end());
+ return llvm::make_range(Set->begin(), Set->end());
}
void CXXRecordDecl::removeConversion(const NamedDecl *ConvDecl) {
OpenPOWER on IntegriCloud