diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-05-16 16:16:31 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-05-16 16:16:31 +0000 |
commit | b4569fb51f8aa959ab6fb1376dc212b8a7b106bc (patch) | |
tree | e45b5bbd5f21a8398f1e8beba7dbbe9c966fec12 | |
parent | a48e0656b6160c2a44f436a9a9c1ae470353e1a9 (diff) | |
download | bcm5719-llvm-b4569fb51f8aa959ab6fb1376dc212b8a7b106bc.tar.gz bcm5719-llvm-b4569fb51f8aa959ab6fb1376dc212b8a7b106bc.zip |
[Sema] Fold array into for-range loop. No functional change intended.
llvm-svn: 237525
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 0c6eac1e95a..57a4689c6d7 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -688,30 +688,28 @@ static void maybeSynthesizeBlockSignature(TypeProcessingState &state, state.setCurrentChunkIndex(declarator.getNumTypeObjects()); } -void diagnoseAndRemoveTypeQualifiers(Sema &S, const DeclSpec &DS, - unsigned &TypeQuals, QualType TypeSoFar, - unsigned RemoveTQs, unsigned DiagID) { +static void diagnoseAndRemoveTypeQualifiers(Sema &S, const DeclSpec &DS, + unsigned &TypeQuals, + QualType TypeSoFar, + unsigned RemoveTQs, + unsigned DiagID) { // If this occurs outside a template instantiation, warn the user about // it; they probably didn't mean to specify a redundant qualifier. typedef std::pair<DeclSpec::TQ, SourceLocation> QualLoc; - QualLoc Quals[] = { - QualLoc(DeclSpec::TQ_const, DS.getConstSpecLoc()), - QualLoc(DeclSpec::TQ_volatile, DS.getVolatileSpecLoc()), - QualLoc(DeclSpec::TQ_atomic, DS.getAtomicSpecLoc()) - }; - - for (unsigned I = 0, N = llvm::array_lengthof(Quals); I != N; ++I) { - if (!(RemoveTQs & Quals[I].first)) + for (QualLoc Qual : {QualLoc(DeclSpec::TQ_const, DS.getConstSpecLoc()), + QualLoc(DeclSpec::TQ_volatile, DS.getVolatileSpecLoc()), + QualLoc(DeclSpec::TQ_atomic, DS.getAtomicSpecLoc())}) { + if (!(RemoveTQs & Qual.first)) continue; if (S.ActiveTemplateInstantiations.empty()) { - if (TypeQuals & Quals[I].first) - S.Diag(Quals[I].second, DiagID) - << DeclSpec::getSpecifierName(Quals[I].first) << TypeSoFar - << FixItHint::CreateRemoval(Quals[I].second); + if (TypeQuals & Qual.first) + S.Diag(Qual.second, DiagID) + << DeclSpec::getSpecifierName(Qual.first) << TypeSoFar + << FixItHint::CreateRemoval(Qual.second); } - TypeQuals &= ~Quals[I].first; + TypeQuals &= ~Qual.first; } } |