r237525 - [Sema] Fold array into for-range loop. No functional change intended.
Benjamin Kramer
benny.kra at googlemail.com
Sat May 16 09:16:32 PDT 2015
Author: d0k
Date: Sat May 16 11:16:31 2015
New Revision: 237525
URL: http://llvm.org/viewvc/llvm-project?rev=237525&view=rev
Log:
[Sema] Fold array into for-range loop. No functional change intended.
Modified:
cfe/trunk/lib/Sema/SemaType.cpp
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=237525&r1=237524&r2=237525&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Sat May 16 11:16:31 2015
@@ -688,30 +688,28 @@ static void maybeSynthesizeBlockSignatur
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;
}
}
More information about the cfe-commits
mailing list