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

Alexander Kornienko alexfh at google.com
Thu Mar 6 02:24:19 PST 2014



================
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) {
----------------
Chandler Carruth wrote:
> const auto &?
Done.

================
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());
----------------
Chandler Carruth wrote:
> const StringRef & makes little sense. just StringRef?
Done.


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

BRANCH
  svn

ARCANIST PROJECT
  clang-tools-extra



More information about the cfe-commits mailing list