summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/Decl.h14
-rw-r--r--clang/include/clang/AST/DeclBase.h14
-rw-r--r--clang/include/clang/AST/DeclObjC.h12
-rw-r--r--clang/include/clang/AST/Redeclarable.h7
-rw-r--r--clang/lib/AST/DeclBase.cpp10
5 files changed, 41 insertions, 16 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index 081101520fe..c4451e73cdc 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -1846,14 +1846,20 @@ public:
typedef llvm::iterator_range<param_iterator> param_range;
typedef llvm::iterator_range<param_const_iterator> param_const_range;
- param_iterator param_begin() { return params().begin(); }
- param_iterator param_end() { return params().end(); }
+ param_iterator param_begin() { return param_iterator(ParamInfo); }
+ param_iterator param_end() {
+ return param_iterator(ParamInfo + param_size());
+ }
param_range params() {
return param_range(ParamInfo, ParamInfo + param_size());
}
- param_const_iterator param_begin() const { return params().begin(); }
- param_const_iterator param_end() const { return params().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_range params() const {
return param_const_range(ParamInfo, ParamInfo + param_size());
}
diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h
index 47a3600e9ca..4139e28afef 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/include/clang/AST/DeclBase.h
@@ -780,8 +780,10 @@ public:
redecl_iterator());
}
- redecl_iterator redecls_begin() const { return redecls().begin(); }
- redecl_iterator redecls_end() const { return redecls().end(); }
+ redecl_iterator redecls_begin() const {
+ return redecl_iterator(const_cast<Decl *>(this));
+ }
+ redecl_iterator redecls_end() const { return redecl_iterator(); }
/// \brief Retrieve the previous declaration that declares the same entity
/// as this declaration, or NULL if there is no previous declaration.
@@ -1311,16 +1313,16 @@ public:
/// decls_begin/decls_end - Iterate over the declarations stored in
/// this context.
decl_range decls() const;
- decl_iterator decls_begin() const { return decls().begin(); }
- decl_iterator decls_end() const { return decls().end(); }
+ decl_iterator decls_begin() const;
+ decl_iterator decls_end() const { return decl_iterator(); }
bool decls_empty() const;
/// 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 { return noload_decls().begin(); }
- decl_iterator noload_decls_end() const { return noload_decls().end(); }
+ decl_iterator noload_decls_begin() const;
+ decl_iterator noload_decls_end() const { return decl_iterator(); }
/// specific_decl_iterator - Iterates over a subrange of
/// declarations stored in a DeclContext, providing only those that
diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h
index 309bb126090..6948443d8d3 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -352,10 +352,14 @@ public:
return param_const_range(getParams(), getParams() + NumParams);
}
- param_const_iterator param_begin() const { return params().begin(); }
- param_const_iterator param_end() const { return params().end(); }
- param_iterator param_begin() { return params().begin(); }
- param_iterator param_end() { return params().end(); }
+ param_const_iterator param_begin() const {
+ return param_const_iterator(getParams());
+ }
+ param_const_iterator param_end() const {
+ return param_const_iterator(getParams() + NumParams);
+ }
+ param_iterator param_begin() { return param_iterator(getParams()); }
+ param_iterator param_end() { return param_iterator(getParams() + NumParams); }
// This method returns and of the parameters which are part of the selector
// name mangling requirements.
diff --git a/clang/include/clang/AST/Redeclarable.h b/clang/include/clang/AST/Redeclarable.h
index 1170eda819c..25b81c2a807 100644
--- a/clang/include/clang/AST/Redeclarable.h
+++ b/clang/include/clang/AST/Redeclarable.h
@@ -171,8 +171,11 @@ public:
redecl_iterator());
}
- redecl_iterator redecls_begin() const { return redecls().begin(); }
- redecl_iterator redecls_end() const { return redecls().end(); }
+ 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(); }
friend class ASTDeclReader;
friend class ASTDeclWriter;
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index 711946ea009..5797e554a3c 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -1080,12 +1080,22 @@ 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();
+ return decl_iterator(FirstDecl);
+}
+
bool DeclContext::decls_empty() const {
if (hasExternalLexicalStorage())
LoadLexicalDeclsFromExternalStorage();
OpenPOWER on IntegriCloud