forked from OSchip/llvm-project
Reapplying r203299 in a slightly different manner. Now range APIs are implemented in terms of iterator APIs.
llvm-svn: 203351
This commit is contained in:
parent
2756adf377
commit
43027eb093
|
@ -1850,9 +1850,7 @@ public:
|
|||
param_iterator param_end() {
|
||||
return param_iterator(ParamInfo + param_size());
|
||||
}
|
||||
param_range params() {
|
||||
return param_range(ParamInfo, ParamInfo + param_size());
|
||||
}
|
||||
param_range params() { return param_range(param_begin(), param_end()); }
|
||||
|
||||
param_const_iterator param_begin() const {
|
||||
return param_const_iterator(ParamInfo);
|
||||
|
@ -1861,7 +1859,7 @@ public:
|
|||
return param_const_iterator(ParamInfo + param_size());
|
||||
}
|
||||
param_const_range params() const {
|
||||
return param_const_range(ParamInfo, ParamInfo + param_size());
|
||||
return param_const_range(param_begin(), param_end());
|
||||
}
|
||||
|
||||
/// getNumParams - Return the number of parameters this function must have
|
||||
|
@ -2339,11 +2337,11 @@ public:
|
|||
typedef NamedDecl * const *chain_iterator;
|
||||
typedef llvm::iterator_range<chain_iterator> chain_range;
|
||||
|
||||
chain_range chain() const {
|
||||
return chain_range(Chaining, Chaining + ChainingSize);
|
||||
chain_range chain() const { return chain_range(chain_begin(), chain_end()); }
|
||||
chain_iterator chain_begin() const { return chain_iterator(Chaining); }
|
||||
chain_iterator chain_end() const {
|
||||
return chain_iterator(Chaining + ChainingSize);
|
||||
}
|
||||
chain_iterator chain_begin() const { return chain().begin(); }
|
||||
chain_iterator chain_end() const { return chain().end(); }
|
||||
|
||||
unsigned getChainingSize() const { return ChainingSize; }
|
||||
|
||||
|
@ -3312,17 +3310,21 @@ public:
|
|||
}
|
||||
|
||||
bool param_empty() const { return NumParams == 0; }
|
||||
param_range params() {
|
||||
return param_range(ParamInfo, ParamInfo + param_size());
|
||||
param_range params() { return param_range(param_begin(), param_end()); }
|
||||
param_iterator param_begin() { return param_iterator(ParamInfo); }
|
||||
param_iterator param_end() {
|
||||
return param_iterator(ParamInfo + param_size());
|
||||
}
|
||||
param_iterator param_begin() { return params().begin(); }
|
||||
param_iterator param_end() { return params().end(); }
|
||||
|
||||
param_const_range params() const {
|
||||
return param_const_range(ParamInfo, ParamInfo + param_size());
|
||||
return param_const_range(param_begin(), param_end());
|
||||
}
|
||||
param_const_iterator param_begin() const {
|
||||
return param_const_iterator(ParamInfo);
|
||||
}
|
||||
param_const_iterator param_end() const {
|
||||
return param_const_iterator(ParamInfo + param_size());
|
||||
}
|
||||
param_const_iterator param_begin() const { return params().begin(); }
|
||||
param_const_iterator param_end() const { return params().end(); }
|
||||
|
||||
unsigned getNumParams() const { return NumParams; }
|
||||
const ParmVarDecl *getParamDecl(unsigned i) const {
|
||||
|
@ -3439,9 +3441,7 @@ public:
|
|||
param_iterator param_end() const { return getParams() + NumParams; }
|
||||
|
||||
/// \brief Retrieve an iterator range for the parameter declarations.
|
||||
param_range params() const {
|
||||
return param_range(getParams(), getParams() + NumParams);
|
||||
}
|
||||
param_range params() const { return param_range(param_begin(), param_end()); }
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
|
|
|
@ -776,8 +776,7 @@ public:
|
|||
/// \brief Returns an iterator range for all the redeclarations of the same
|
||||
/// decl. It will iterate at least once (when this decl is the only one).
|
||||
redecl_range redecls() const {
|
||||
return redecl_range(redecl_iterator(const_cast<Decl *>(this)),
|
||||
redecl_iterator());
|
||||
return redecl_range(redecls_begin(), redecls_end());
|
||||
}
|
||||
|
||||
redecl_iterator redecls_begin() const {
|
||||
|
@ -1312,7 +1311,7 @@ public:
|
|||
|
||||
/// decls_begin/decls_end - Iterate over the declarations stored in
|
||||
/// this context.
|
||||
decl_range decls() const;
|
||||
decl_range decls() const { return decl_range(decls_begin(), decls_end()); }
|
||||
decl_iterator decls_begin() const;
|
||||
decl_iterator decls_end() const { return decl_iterator(); }
|
||||
bool decls_empty() const;
|
||||
|
@ -1320,8 +1319,10 @@ public:
|
|||
/// noload_decls_begin/end - Iterate over the declarations stored in this
|
||||
/// context that are currently loaded; don't attempt to retrieve anything
|
||||
/// from an external source.
|
||||
decl_range noload_decls() const;
|
||||
decl_iterator noload_decls_begin() const;
|
||||
decl_range noload_decls() const {
|
||||
return decl_range(noload_decls_begin(), noload_decls_end());
|
||||
}
|
||||
decl_iterator noload_decls_begin() const { return decl_iterator(FirstDecl); }
|
||||
decl_iterator noload_decls_end() const { return decl_iterator(); }
|
||||
|
||||
/// specific_decl_iterator - Iterates over a subrange of
|
||||
|
|
|
@ -345,11 +345,9 @@ public:
|
|||
typedef llvm::iterator_range<param_iterator> param_range;
|
||||
typedef llvm::iterator_range<param_const_iterator> param_const_range;
|
||||
|
||||
param_range params() {
|
||||
return param_range(getParams(), getParams() + NumParams);
|
||||
}
|
||||
param_range params() { return param_range(param_begin(), param_end()); }
|
||||
param_const_range params() const {
|
||||
return param_const_range(getParams(), getParams() + NumParams);
|
||||
return param_const_range(param_begin(), param_end());
|
||||
}
|
||||
|
||||
param_const_iterator param_begin() const {
|
||||
|
@ -1277,9 +1275,9 @@ public:
|
|||
bool RHSIsQualifiedID = false);
|
||||
|
||||
typedef redeclarable_base::redecl_range redecl_range;
|
||||
typedef redeclarable_base::redecl_iterator redecl_iterator;
|
||||
using redeclarable_base::redecls_begin;
|
||||
using redeclarable_base::redecls_end;
|
||||
typedef redeclarable_base::redecl_iterator redecl_iterator;
|
||||
using redeclarable_base::redecls_begin;
|
||||
using redeclarable_base::redecls_end;
|
||||
using redeclarable_base::redecls;
|
||||
using redeclarable_base::getPreviousDecl;
|
||||
using redeclarable_base::getMostRecentDecl;
|
||||
|
@ -1586,9 +1584,9 @@ public:
|
|||
}
|
||||
|
||||
typedef redeclarable_base::redecl_range redecl_range;
|
||||
typedef redeclarable_base::redecl_iterator redecl_iterator;
|
||||
using redeclarable_base::redecls_begin;
|
||||
using redeclarable_base::redecls_end;
|
||||
typedef redeclarable_base::redecl_iterator redecl_iterator;
|
||||
using redeclarable_base::redecls_begin;
|
||||
using redeclarable_base::redecls_end;
|
||||
using redeclarable_base::redecls;
|
||||
using redeclarable_base::getPreviousDecl;
|
||||
using redeclarable_base::getMostRecentDecl;
|
||||
|
|
|
@ -171,11 +171,8 @@ public:
|
|||
redecl_iterator());
|
||||
}
|
||||
|
||||
redecl_iterator redecls_begin() const {
|
||||
return redecl_iterator(
|
||||
const_cast<decl_type *>(static_cast<const decl_type *>(this)));
|
||||
}
|
||||
redecl_iterator redecls_end() const { return redecl_iterator(); }
|
||||
redecl_iterator redecls_begin() const { return redecls().begin(); }
|
||||
redecl_iterator redecls_end() const { return redecls().end(); }
|
||||
|
||||
friend class ASTDeclReader;
|
||||
friend class ASTDeclWriter;
|
||||
|
|
|
@ -1076,20 +1076,6 @@ ExternalASTSource::SetExternalVisibleDeclsForName(const DeclContext *DC,
|
|||
return List.getLookupResult();
|
||||
}
|
||||
|
||||
DeclContext::decl_range DeclContext::noload_decls() const {
|
||||
return decl_range(decl_iterator(FirstDecl), decl_iterator());
|
||||
}
|
||||
|
||||
DeclContext::decl_iterator DeclContext::noload_decls_begin() const {
|
||||
return decl_iterator(FirstDecl);
|
||||
}
|
||||
|
||||
DeclContext::decl_range DeclContext::decls() const {
|
||||
if (hasExternalLexicalStorage())
|
||||
LoadLexicalDeclsFromExternalStorage();
|
||||
return decl_range(decl_iterator(FirstDecl), decl_iterator());
|
||||
}
|
||||
|
||||
DeclContext::decl_iterator DeclContext::decls_begin() const {
|
||||
if (hasExternalLexicalStorage())
|
||||
LoadLexicalDeclsFromExternalStorage();
|
||||
|
|
Loading…
Reference in New Issue