From b97112e4bd8bf9051822ca2b3d99115c683c2cae Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Sat, 8 Mar 2014 22:19:01 +0000 Subject: [C++11] Replacing Decl iterators attr_begin() and attr_end() with iterator_range attrs(). Updating all of the usages of the iterators with range-based for loops. This is a reapplication of r203236 with modifications to the definition of attrs() and following the new style guidelines on auto usage. llvm-svn: 203362 --- clang/lib/Sema/SemaDeclCXX.cpp | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) (limited to 'clang/lib/Sema/SemaDeclCXX.cpp') diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 5daa46bd0d9..027fd6f309a 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -12673,48 +12673,41 @@ bool Sema::checkThisInStaticMemberFunctionAttributes(CXXMethodDecl *Method) { FindCXXThisExpr Finder(*this); // Check attributes. - for (Decl::attr_iterator A = Method->attr_begin(), AEnd = Method->attr_end(); - A != AEnd; ++A) { + for (const auto *A : Method->attrs()) { // FIXME: This should be emitted by tblgen. Expr *Arg = 0; ArrayRef Args; - if (GuardedByAttr *G = dyn_cast(*A)) + if (const auto *G = dyn_cast(A)) Arg = G->getArg(); - else if (PtGuardedByAttr *G = dyn_cast(*A)) + else if (const auto *G = dyn_cast(A)) Arg = G->getArg(); - else if (AcquiredAfterAttr *AA = dyn_cast(*A)) + else if (const auto *AA = dyn_cast(A)) Args = ArrayRef(AA->args_begin(), AA->args_size()); - else if (AcquiredBeforeAttr *AB = dyn_cast(*A)) + else if (const auto *AB = dyn_cast(A)) Args = ArrayRef(AB->args_begin(), AB->args_size()); - else if (ExclusiveLockFunctionAttr *ELF - = dyn_cast(*A)) + else if (const auto *ELF = dyn_cast(A)) Args = ArrayRef(ELF->args_begin(), ELF->args_size()); - else if (SharedLockFunctionAttr *SLF - = dyn_cast(*A)) + else if (const auto *SLF = dyn_cast(A)) Args = ArrayRef(SLF->args_begin(), SLF->args_size()); - else if (ExclusiveTrylockFunctionAttr *ETLF - = dyn_cast(*A)) { + else if (const auto *ETLF = dyn_cast(A)) { Arg = ETLF->getSuccessValue(); Args = ArrayRef(ETLF->args_begin(), ETLF->args_size()); - } else if (SharedTrylockFunctionAttr *STLF - = dyn_cast(*A)) { + } else if (const auto *STLF = dyn_cast(A)) { Arg = STLF->getSuccessValue(); Args = ArrayRef(STLF->args_begin(), STLF->args_size()); - } else if (UnlockFunctionAttr *UF = dyn_cast(*A)) + } else if (const auto *UF = dyn_cast(A)) Args = ArrayRef(UF->args_begin(), UF->args_size()); - else if (LockReturnedAttr *LR = dyn_cast(*A)) + else if (const auto *LR = dyn_cast(A)) Arg = LR->getArg(); - else if (LocksExcludedAttr *LE = dyn_cast(*A)) + else if (const auto *LE = dyn_cast(A)) Args = ArrayRef(LE->args_begin(), LE->args_size()); - else if (RequiresCapabilityAttr *RC - = dyn_cast(*A)) + else if (const auto *RC = dyn_cast(A)) Args = ArrayRef(RC->args_begin(), RC->args_size()); - else if (AcquireCapabilityAttr *AC = dyn_cast(*A)) + else if (const auto *AC = dyn_cast(A)) Args = ArrayRef(AC->args_begin(), AC->args_size()); - else if (TryAcquireCapabilityAttr *AC - = dyn_cast(*A)) - Args = ArrayRef(AC->args_begin(), AC->args_size()); - else if (ReleaseCapabilityAttr *RC = dyn_cast(*A)) + else if (const auto *AC = dyn_cast(A)) + Args = ArrayRef(AC->args_begin(), AC->args_size()); + else if (const auto *RC = dyn_cast(A)) Args = ArrayRef(RC->args_begin(), RC->args_size()); if (Arg && !Finder.TraverseStmt(Arg)) -- cgit v1.2.3