diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-03-08 20:12:42 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-03-08 20:12:42 +0000 |
commit | e8a8baef44c4df704170c74f6117b8541b1ec752 (patch) | |
tree | 4267c871876046245818e1d246fa452cea91004a /clang/lib/CodeGen/CGClass.cpp | |
parent | 1b91204e3dafe5eb8eafa50ad1d51494ee0ef854 (diff) | |
download | bcm5719-llvm-e8a8baef44c4df704170c74f6117b8541b1ec752.tar.gz bcm5719-llvm-e8a8baef44c4df704170c74f6117b8541b1ec752.zip |
[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
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
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<DestroyField>(cleanupKind, field, + EHStack.pushCleanup<DestroyField>(cleanupKind, Field, getDestroyer(dtorKind), cleanupKind & EHCleanup); } |