diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp --- a/clang/lib/AST/ASTDiagnostic.cpp +++ b/clang/lib/AST/ASTDiagnostic.cpp @@ -270,9 +270,9 @@ std::string S = Ty.getAsString(Context.getPrintingPolicy()); std::string CanS = CanTy.getAsString(Context.getPrintingPolicy()); - for (unsigned I = 0, E = QualTypeVals.size(); I != E; ++I) { + for (const intptr_t &QualTypeVal : QualTypeVals) { QualType CompareTy = - QualType::getFromOpaquePtr(reinterpret_cast(QualTypeVals[I])); + QualType::getFromOpaquePtr(reinterpret_cast(QualTypeVal)); if (CompareTy.isNull()) continue; if (CompareTy == Ty) @@ -302,10 +302,10 @@ // Check to see if we already desugared this type in this // diagnostic. If so, don't do it again. bool Repeated = false; - for (unsigned i = 0, e = PrevArgs.size(); i != e; ++i) { + for (const auto &PrevArg : PrevArgs) { // TODO: Handle ak_declcontext case. - if (PrevArgs[i].first == DiagnosticsEngine::ak_qualtype) { - void *Ptr = (void*)PrevArgs[i].second; + if (PrevArg.first == DiagnosticsEngine::ak_qualtype) { + void *Ptr = (void *)PrevArg.second; QualType PrevTy(QualType::getFromOpaquePtr(Ptr)); if (PrevTy == Ty) { Repeated = true;