forked from OSchip/llvm-project
[C++11] Replacing Scope iterators decl_begin() and decl_end() with iterator_range decls(). Updating all of the usages of the iterators with range-based for loops, and removing the no-longer-needed iterator versions.
llvm-svn: 204052
This commit is contained in:
parent
650459721a
commit
35c5495bbb
|
@ -235,10 +235,11 @@ public:
|
|||
return PrototypeIndex++;
|
||||
}
|
||||
|
||||
typedef DeclSetTy::iterator decl_iterator;
|
||||
decl_iterator decl_begin() const { return DeclsInScope.begin(); }
|
||||
decl_iterator decl_end() const { return DeclsInScope.end(); }
|
||||
bool decl_empty() const { return DeclsInScope.empty(); }
|
||||
typedef llvm::iterator_range<DeclSetTy::iterator> decl_range;
|
||||
decl_range decls() const {
|
||||
return decl_range(DeclsInScope.begin(), DeclsInScope.end());
|
||||
}
|
||||
bool decl_empty() const { return DeclsInScope.empty(); }
|
||||
|
||||
void AddDecl(Decl *D) {
|
||||
DeclsInScope.insert(D);
|
||||
|
|
|
@ -4335,9 +4335,8 @@ void Sema::CodeCompleteLambdaIntroducer(Scope *S, LambdaIntroducer &Intro,
|
|||
|
||||
// Look for other capturable variables.
|
||||
for (; S && !isNamespaceScope(S); S = S->getParent()) {
|
||||
for (Scope::decl_iterator D = S->decl_begin(), DEnd = S->decl_end();
|
||||
D != DEnd; ++D) {
|
||||
VarDecl *Var = dyn_cast<VarDecl>(*D);
|
||||
for (const auto *D : S->decls()) {
|
||||
const auto *Var = dyn_cast<VarDecl>(D);
|
||||
if (!Var ||
|
||||
!Var->hasLocalStorage() ||
|
||||
Var->hasAttr<BlocksAttr>())
|
||||
|
|
|
@ -1375,9 +1375,7 @@ void Sema::ActOnPopScope(SourceLocation Loc, Scope *S) {
|
|||
assert((S->getFlags() & (Scope::DeclScope | Scope::TemplateParamScope)) &&
|
||||
"Scope shouldn't contain decls!");
|
||||
|
||||
for (Scope::decl_iterator I = S->decl_begin(), E = S->decl_end();
|
||||
I != E; ++I) {
|
||||
Decl *TmpD = (*I);
|
||||
for (auto *TmpD : S->decls()) {
|
||||
assert(TmpD && "This decl didn't get pushed??");
|
||||
|
||||
assert(isa<NamedDecl>(TmpD) && "Decl isn't NamedDecl?");
|
||||
|
|
|
@ -3190,9 +3190,8 @@ static void LookupVisibleDecls(Scope *S, LookupResult &Result,
|
|||
(S->getEntity())->isFunctionOrMethod()) {
|
||||
FindLocalExternScope FindLocals(Result);
|
||||
// Walk through the declarations in this Scope.
|
||||
for (Scope::decl_iterator D = S->decl_begin(), DEnd = S->decl_end();
|
||||
D != DEnd; ++D) {
|
||||
if (NamedDecl *ND = dyn_cast<NamedDecl>(*D))
|
||||
for (auto *D : S->decls()) {
|
||||
if (NamedDecl *ND = dyn_cast<NamedDecl>(D))
|
||||
if ((ND = Result.getAcceptableDecl(ND))) {
|
||||
Consumer.FoundDecl(ND, Visited.checkHidden(ND), 0, false);
|
||||
Visited.add(ND);
|
||||
|
|
Loading…
Reference in New Issue