зеркало из https://github.com/microsoft/clang-1.git
Slim down the specific_decl_iterator, since NULL denotes the end of the range. Good eyes, Chris
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63528 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
87fd703e09
Коммит
d6f0b4e97e
|
@ -927,11 +927,11 @@ public:
|
||||||
typedef specific_decl_iterator<EnumConstantDecl> enumerator_iterator;
|
typedef specific_decl_iterator<EnumConstantDecl> enumerator_iterator;
|
||||||
|
|
||||||
enumerator_iterator enumerator_begin() const {
|
enumerator_iterator enumerator_begin() const {
|
||||||
return enumerator_iterator(this->decls_begin(), this->decls_end());
|
return enumerator_iterator(this->decls_begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
enumerator_iterator enumerator_end() const {
|
enumerator_iterator enumerator_end() const {
|
||||||
return enumerator_iterator(this->decls_end(), this->decls_end());
|
return enumerator_iterator(this->decls_end());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getIntegerType - Return the integer type this enum decl corresponds to.
|
/// getIntegerType - Return the integer type this enum decl corresponds to.
|
||||||
|
@ -1022,10 +1022,10 @@ public:
|
||||||
typedef specific_decl_iterator<FieldDecl> field_iterator;
|
typedef specific_decl_iterator<FieldDecl> field_iterator;
|
||||||
|
|
||||||
field_iterator field_begin() const {
|
field_iterator field_begin() const {
|
||||||
return field_iterator(decls_begin(), decls_end());
|
return field_iterator(decls_begin());
|
||||||
}
|
}
|
||||||
field_iterator field_end() const {
|
field_iterator field_end() const {
|
||||||
return field_iterator(decls_end(), decls_end());
|
return field_iterator(decls_end());
|
||||||
}
|
}
|
||||||
|
|
||||||
// field_empty - Whether there are any fields (non-static data
|
// field_empty - Whether there are any fields (non-static data
|
||||||
|
|
|
@ -640,13 +640,10 @@ public:
|
||||||
template<typename SpecificDecl>
|
template<typename SpecificDecl>
|
||||||
class specific_decl_iterator {
|
class specific_decl_iterator {
|
||||||
/// Current - The current, underlying declaration iterator, which
|
/// Current - The current, underlying declaration iterator, which
|
||||||
/// will either be the same as End or will point to a declaration of
|
/// will either be NULL or will point to a declaration of
|
||||||
/// type SpecificDecl.
|
/// type SpecificDecl.
|
||||||
DeclContext::decl_iterator Current;
|
DeclContext::decl_iterator Current;
|
||||||
|
|
||||||
/// End - One past the last declaration within the DeclContext.
|
|
||||||
DeclContext::decl_iterator End;
|
|
||||||
|
|
||||||
/// Acceptable - If non-NULL, points to a member function that
|
/// Acceptable - If non-NULL, points to a member function that
|
||||||
/// will determine if a particular declaration of type
|
/// will determine if a particular declaration of type
|
||||||
/// SpecificDecl should be visited by the iteration.
|
/// SpecificDecl should be visited by the iteration.
|
||||||
|
@ -656,7 +653,7 @@ public:
|
||||||
/// declaration of type SpecificDecl that also meets the criteria
|
/// declaration of type SpecificDecl that also meets the criteria
|
||||||
/// required by Acceptable.
|
/// required by Acceptable.
|
||||||
void SkipToNextDecl() {
|
void SkipToNextDecl() {
|
||||||
while (Current != End &&
|
while (*Current &&
|
||||||
(!isa<SpecificDecl>(*Current) ||
|
(!isa<SpecificDecl>(*Current) ||
|
||||||
(Acceptable && !(cast<SpecificDecl>(*Current)->*Acceptable)())))
|
(Acceptable && !(cast<SpecificDecl>(*Current)->*Acceptable)())))
|
||||||
++Current;
|
++Current;
|
||||||
|
@ -670,19 +667,19 @@ public:
|
||||||
difference_type;
|
difference_type;
|
||||||
typedef std::forward_iterator_tag iterator_category;
|
typedef std::forward_iterator_tag iterator_category;
|
||||||
|
|
||||||
specific_decl_iterator() : Current(), End(), Acceptable(0) { }
|
specific_decl_iterator() : Current(), Acceptable(0) { }
|
||||||
|
|
||||||
/// specific_decl_iterator - Construct a new iterator over a
|
/// specific_decl_iterator - Construct a new iterator over a
|
||||||
/// subset of the declarations in [C, E). If A is non-NULL, it is
|
/// subset of the declarations the range [C,
|
||||||
/// a pointer to a member function of SpecificDecl that should
|
/// end-of-declarations). If A is non-NULL, it is a pointer to a
|
||||||
/// return true for all of the SpecificDecl instances that will be
|
/// member function of SpecificDecl that should return true for
|
||||||
/// in the subset of iterators. For example, if you want
|
/// all of the SpecificDecl instances that will be in the subset
|
||||||
/// Objective-C instance methods, SpecificDecl will be
|
/// of iterators. For example, if you want Objective-C instance
|
||||||
/// ObjCMethodDecl and A will be &ObjCMethodDecl::isInstanceMethod.
|
/// methods, SpecificDecl will be ObjCMethodDecl and A will be
|
||||||
|
/// &ObjCMethodDecl::isInstanceMethod.
|
||||||
specific_decl_iterator(DeclContext::decl_iterator C,
|
specific_decl_iterator(DeclContext::decl_iterator C,
|
||||||
DeclContext::decl_iterator E,
|
|
||||||
bool (SpecificDecl::*A)() const = 0)
|
bool (SpecificDecl::*A)() const = 0)
|
||||||
: Current(C), End(E), Acceptable(A) {
|
: Current(C), Acceptable(A) {
|
||||||
SkipToNextDecl();
|
SkipToNextDecl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -264,39 +264,35 @@ public:
|
||||||
// Iterator access to properties.
|
// Iterator access to properties.
|
||||||
typedef specific_decl_iterator<ObjCPropertyDecl> prop_iterator;
|
typedef specific_decl_iterator<ObjCPropertyDecl> prop_iterator;
|
||||||
prop_iterator prop_begin() const {
|
prop_iterator prop_begin() const {
|
||||||
return prop_iterator(decls_begin(), decls_end());
|
return prop_iterator(decls_begin());
|
||||||
}
|
}
|
||||||
prop_iterator prop_end() const {
|
prop_iterator prop_end() const {
|
||||||
return prop_iterator(decls_end(), decls_end());
|
return prop_iterator(decls_end());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterator access to instance/class methods.
|
// Iterator access to instance/class methods.
|
||||||
typedef specific_decl_iterator<ObjCMethodDecl> method_iterator;
|
typedef specific_decl_iterator<ObjCMethodDecl> method_iterator;
|
||||||
method_iterator meth_begin() const {
|
method_iterator meth_begin() const {
|
||||||
return method_iterator(decls_begin(), decls_end());
|
return method_iterator(decls_begin());
|
||||||
}
|
}
|
||||||
method_iterator meth_end() const {
|
method_iterator meth_end() const {
|
||||||
return method_iterator(decls_end(), decls_end());
|
return method_iterator(decls_end());
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef method_iterator instmeth_iterator;
|
typedef method_iterator instmeth_iterator;
|
||||||
instmeth_iterator instmeth_begin() const {
|
instmeth_iterator instmeth_begin() const {
|
||||||
return instmeth_iterator(decls_begin(), decls_end(),
|
return instmeth_iterator(decls_begin(), &ObjCMethodDecl::isInstanceMethod);
|
||||||
&ObjCMethodDecl::isInstanceMethod);
|
|
||||||
}
|
}
|
||||||
instmeth_iterator instmeth_end() const {
|
instmeth_iterator instmeth_end() const {
|
||||||
return instmeth_iterator(decls_end(), decls_end(),
|
return instmeth_iterator(decls_end(), &ObjCMethodDecl::isInstanceMethod);
|
||||||
&ObjCMethodDecl::isInstanceMethod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef method_iterator classmeth_iterator;
|
typedef method_iterator classmeth_iterator;
|
||||||
classmeth_iterator classmeth_begin() const {
|
classmeth_iterator classmeth_begin() const {
|
||||||
return classmeth_iterator(decls_begin(), decls_end(),
|
return classmeth_iterator(decls_begin(), &ObjCMethodDecl::isClassMethod);
|
||||||
&ObjCMethodDecl::isClassMethod);
|
|
||||||
}
|
}
|
||||||
classmeth_iterator classmeth_end() const {
|
classmeth_iterator classmeth_end() const {
|
||||||
return classmeth_iterator(decls_end(), decls_end(),
|
return classmeth_iterator(decls_end(), &ObjCMethodDecl::isClassMethod);
|
||||||
&ObjCMethodDecl::isClassMethod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the local instance/class method declared in this interface.
|
// Get the local instance/class method declared in this interface.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче