forked from OSchip/llvm-project
[C++11] Replacing ObjCInterfaceDecl iterators known_extensions_begin() and known_extensions_end() with iterator_range known_extensions(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203857
This commit is contained in:
parent
5cff0e6a81
commit
b4a5345598
|
@ -1196,6 +1196,13 @@ public:
|
|||
/// \brief Iterator that walks over all of the known extensions.
|
||||
typedef filtered_category_iterator<isKnownExtension>
|
||||
known_extensions_iterator;
|
||||
typedef llvm::iterator_range<known_extensions_iterator>
|
||||
known_extensions_range;
|
||||
|
||||
known_extensions_range known_extensions() const {
|
||||
return known_extensions_range(known_extensions_begin(),
|
||||
known_extensions_end());
|
||||
}
|
||||
|
||||
/// \brief Retrieve an iterator to the beginning of the known-extensions
|
||||
/// list.
|
||||
|
|
|
@ -387,10 +387,7 @@ static void addRedeclaredMethods(const ObjCMethodDecl *ObjCMethod,
|
|||
if (!ID)
|
||||
return;
|
||||
// Add redeclared method here.
|
||||
for (ObjCInterfaceDecl::known_extensions_iterator
|
||||
Ext = ID->known_extensions_begin(),
|
||||
ExtEnd = ID->known_extensions_end();
|
||||
Ext != ExtEnd; ++Ext) {
|
||||
for (const auto *Ext : ID->known_extensions()) {
|
||||
if (ObjCMethodDecl *RedeclaredMethod =
|
||||
Ext->getMethod(ObjCMethod->getSelector(),
|
||||
ObjCMethod->isInstanceMethod()))
|
||||
|
@ -1854,12 +1851,8 @@ void ASTContext::CollectInheritedProtocols(const Decl *CDecl,
|
|||
unsigned ASTContext::CountNonClassIvars(const ObjCInterfaceDecl *OI) const {
|
||||
unsigned count = 0;
|
||||
// Count ivars declared in class extension.
|
||||
for (ObjCInterfaceDecl::known_extensions_iterator
|
||||
Ext = OI->known_extensions_begin(),
|
||||
ExtEnd = OI->known_extensions_end();
|
||||
Ext != ExtEnd; ++Ext) {
|
||||
for (const auto *Ext : OI->known_extensions())
|
||||
count += Ext->ivar_size();
|
||||
}
|
||||
|
||||
// Count ivar defined in this class's implementation. This
|
||||
// includes synthesized ivars.
|
||||
|
|
|
@ -1224,10 +1224,7 @@ ObjCIvarDecl *ObjCInterfaceDecl::all_declared_ivar_begin() {
|
|||
curIvar->setNextIvar(*I);
|
||||
}
|
||||
|
||||
for (ObjCInterfaceDecl::known_extensions_iterator
|
||||
Ext = known_extensions_begin(),
|
||||
ExtEnd = known_extensions_end();
|
||||
Ext != ExtEnd; ++Ext) {
|
||||
for (const auto *Ext : known_extensions()) {
|
||||
if (!Ext->ivar_empty()) {
|
||||
ObjCCategoryDecl::ivar_iterator
|
||||
I = Ext->ivar_begin(),
|
||||
|
|
|
@ -12249,10 +12249,7 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl,
|
|||
Diag(ClsIvar->getLocation(), diag::note_previous_definition);
|
||||
continue;
|
||||
}
|
||||
for (ObjCInterfaceDecl::known_extensions_iterator
|
||||
Ext = IDecl->known_extensions_begin(),
|
||||
ExtEnd = IDecl->known_extensions_end();
|
||||
Ext != ExtEnd; ++Ext) {
|
||||
for (const auto *Ext : IDecl->known_extensions()) {
|
||||
if (const ObjCIvarDecl *ClsExtIvar
|
||||
= Ext->getIvarDecl(ClsFields[i]->getIdentifier())) {
|
||||
Diag(ClsFields[i]->getLocation(),
|
||||
|
|
|
@ -343,12 +343,9 @@ Sema::HandlePropertyInClassExtension(Scope *S,
|
|||
if (CCPrimary) {
|
||||
// Check for duplicate declaration of this property in current and
|
||||
// other class extensions.
|
||||
for (ObjCInterfaceDecl::known_extensions_iterator
|
||||
Ext = CCPrimary->known_extensions_begin(),
|
||||
ExtEnd = CCPrimary->known_extensions_end();
|
||||
Ext != ExtEnd; ++Ext) {
|
||||
for (const auto *Ext : CCPrimary->known_extensions()) {
|
||||
if (ObjCPropertyDecl *prevDecl
|
||||
= ObjCPropertyDecl::findPropertyDecl(*Ext, PropertyId)) {
|
||||
= ObjCPropertyDecl::findPropertyDecl(Ext, PropertyId)) {
|
||||
Diag(AtLoc, diag::err_duplicate_property);
|
||||
Diag(prevDecl->getLocation(), diag::note_property_declare);
|
||||
return 0;
|
||||
|
@ -868,9 +865,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
|
|||
bool ReadWriteProperty = false;
|
||||
// Search into the class extensions and see if 'readonly property is
|
||||
// redeclared 'readwrite', then no warning is to be issued.
|
||||
for (ObjCInterfaceDecl::known_extensions_iterator
|
||||
Ext = IDecl->known_extensions_begin(),
|
||||
ExtEnd = IDecl->known_extensions_end(); Ext != ExtEnd; ++Ext) {
|
||||
for (auto *Ext : IDecl->known_extensions()) {
|
||||
DeclContext::lookup_result R = Ext->lookup(property->getDeclName());
|
||||
if (!R.empty())
|
||||
if (ObjCPropertyDecl *ExtProp = dyn_cast<ObjCPropertyDecl>(R[0])) {
|
||||
|
|
Loading…
Reference in New Issue