diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-03-07 12:50:00 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-03-07 12:50:00 +0000 |
commit | 690829696ca4c73a8cb1688761e9b1152a7d2254 (patch) | |
tree | e390869177171f89dd393dfcb2a822b53198b092 /clang/lib/Sema/SemaDecl.cpp | |
parent | f3f3b9e5b6a8a37f192a227158c2abae5ead28db (diff) | |
download | bcm5719-llvm-690829696ca4c73a8cb1688761e9b1152a7d2254.tar.gz bcm5719-llvm-690829696ca4c73a8cb1688761e9b1152a7d2254.zip |
[C++11] Replacing iterators attr_begin() and attr_end() with iterator_range attrs(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203236
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 9840d1eca11..f0a24301d53 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1791,16 +1791,16 @@ void Sema::MergeTypedefNameDecl(TypedefNameDecl *New, LookupResult &OldDecls) { static bool DeclHasAttr(const Decl *D, const Attr *A) { const OwnershipAttr *OA = dyn_cast<OwnershipAttr>(A); const AnnotateAttr *Ann = dyn_cast<AnnotateAttr>(A); - for (Decl::attr_iterator i = D->attr_begin(), e = D->attr_end(); i != e; ++i) - if ((*i)->getKind() == A->getKind()) { + for (auto i : D->attrs()) + if (i->getKind() == A->getKind()) { if (Ann) { - if (Ann->getAnnotation() == cast<AnnotateAttr>(*i)->getAnnotation()) + if (Ann->getAnnotation() == cast<AnnotateAttr>(i)->getAnnotation()) return true; continue; } // FIXME: Don't hardcode this check - if (OA && isa<OwnershipAttr>(*i)) - return OA->getOwnKind() == cast<OwnershipAttr>(*i)->getOwnKind(); + if (OA && isa<OwnershipAttr>(i)) + return OA->getOwnKind() == cast<OwnershipAttr>(i)->getOwnKind(); return true; } @@ -1997,12 +1997,9 @@ static const Decl *getDefinition(const Decl *D) { } static bool hasAttribute(const Decl *D, attr::Kind Kind) { - for (Decl::attr_iterator I = D->attr_begin(), E = D->attr_end(); - I != E; ++I) { - Attr *Attribute = *I; + for (auto Attribute : D->attrs()) if (Attribute->getKind() == Kind) return true; - } return false; } |