[PATCH] Use range-based for loops for better readability. No functional changes intended.

Chandler Carruth chandlerc at gmail.com
Thu Mar 6 01:58:21 PST 2014


  Nits below.


================
Comment at: clang-tidy/ClangTidy.cpp:159
@@ -171,7 +158,3 @@
   std::vector<std::string> CheckNames;
-  for (ClangTidyCheckFactories::FactoryMap::const_iterator
-           I = CheckFactories->begin(),
-           E = CheckFactories->end();
-       I != E; ++I) {
-    if (Filter.IsCheckEnabled(I->first))
-      CheckNames.push_back(I->first);
+  for (const std::pair<std::string, CheckFactoryBase *> &CheckFactory :
+       *CheckFactories) {
----------------
const auto &?

================
Comment at: clang-tidy/ClangTidy.cpp:192
@@ -209,3 +191,3 @@
     // rely on the core checkers.
-    for (unsigned i = 0; i < Checks.size(); ++i) {
-      std::string Checker((AnalyzerCheckNamePrefix + Checks[i]).str());
+    for (const StringRef &CheckName : Checks) {
+      std::string Checker((AnalyzerCheckNamePrefix + CheckName).str());
----------------
const StringRef & makes little sense. just StringRef?


http://llvm-reviews.chandlerc.com/D2979

BRANCH
  svn

ARCANIST PROJECT
  clang-tools-extra



More information about the cfe-commits mailing list