From e8a8baef44c4df704170c74f6117b8541b1ec752 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Sat, 8 Mar 2014 20:12:42 +0000 Subject: [C++11] Replacing RecordDecl iterators field_begin() and field_end() with iterator_range fields(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203355 --- clang/lib/CodeGen/CGClass.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'clang/lib/CodeGen/CGClass.cpp') diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index cc8f20c0e92..92400b1b39c 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -1195,13 +1195,9 @@ HasTrivialDestructorBody(ASTContext &Context, return false; // Check fields. - for (CXXRecordDecl::field_iterator I = BaseClassDecl->field_begin(), - E = BaseClassDecl->field_end(); I != E; ++I) { - const FieldDecl *Field = *I; - + for (const auto *Field : BaseClassDecl->fields()) if (!FieldHasTrivialDestructorBody(Context, Field)) return false; - } // Check non-virtual bases. for (CXXRecordDecl::base_class_const_iterator I = @@ -1256,13 +1252,9 @@ static bool CanSkipVTablePointerInitialization(ASTContext &Context, // Check the fields. const CXXRecordDecl *ClassDecl = Dtor->getParent(); - for (CXXRecordDecl::field_iterator I = ClassDecl->field_begin(), - E = ClassDecl->field_end(); I != E; ++I) { - const FieldDecl *Field = *I; - + for (const auto *Field : ClassDecl->fields()) if (!FieldHasTrivialDestructorBody(Context, Field)) return false; - } return true; } @@ -1512,10 +1504,8 @@ void CodeGenFunction::EnterDtorCleanups(const CXXDestructorDecl *DD, } // Destroy direct fields. - for (CXXRecordDecl::field_iterator I = ClassDecl->field_begin(), - E = ClassDecl->field_end(); I != E; ++I) { - const FieldDecl *field = *I; - QualType type = field->getType(); + for (const auto *Field : ClassDecl->fields()) { + QualType type = Field->getType(); QualType::DestructionKind dtorKind = type.isDestructedType(); if (!dtorKind) continue; @@ -1524,7 +1514,7 @@ void CodeGenFunction::EnterDtorCleanups(const CXXDestructorDecl *DD, if (RT && RT->getDecl()->isAnonymousStructOrUnion()) continue; CleanupKind cleanupKind = getCleanupKind(dtorKind); - EHStack.pushCleanup(cleanupKind, field, + EHStack.pushCleanup(cleanupKind, Field, getDestroyer(dtorKind), cleanupKind & EHCleanup); } -- cgit v1.2.3