[llvm] r236164 - [NFC] Updating FileCheck to reduce the std::vector interface used via cl::list.

Chris Bieneman beanz at apple.com
Wed Apr 29 14:45:24 PDT 2015


Author: cbieneman
Date: Wed Apr 29 16:45:24 2015
New Revision: 236164

URL: http://llvm.org/viewvc/llvm-project?rev=236164&view=rev
Log:
[NFC] Updating FileCheck to reduce the std::vector interface used via cl::list.

Modified:
    llvm/trunk/utils/FileCheck/FileCheck.cpp

Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=236164&r1=236163&r2=236164&view=diff
==============================================================================
--- llvm/trunk/utils/FileCheck/FileCheck.cpp (original)
+++ llvm/trunk/utils/FileCheck/FileCheck.cpp Wed Apr 29 16:45:24 2015
@@ -958,7 +958,7 @@ static bool ReadCheckFile(SourceMgr &SM,
   // prefix as a filler for the error message.
   if (!DagNotMatches.empty()) {
     CheckStrings.push_back(CheckString(Pattern(Check::CheckEOF),
-                                       CheckPrefixes[0],
+                                       *CheckPrefixes.begin(),
                                        SMLoc::getFromPointer(Buffer.data()),
                                        Check::CheckEOF));
     std::swap(DagNotMatches, CheckStrings.back().DagNotStrings);
@@ -967,12 +967,14 @@ static bool ReadCheckFile(SourceMgr &SM,
   if (CheckStrings.empty()) {
     errs() << "error: no check strings found with prefix"
            << (CheckPrefixes.size() > 1 ? "es " : " ");
-    for (size_t I = 0, N = CheckPrefixes.size(); I != N; ++I) {
-      StringRef Prefix(CheckPrefixes[I]);
-      errs() << '\'' << Prefix << ":'";
-      if (I != N - 1)
-        errs() << ", ";
+    prefix_iterator I = CheckPrefixes.begin();
+    prefix_iterator E = CheckPrefixes.end();
+    if (I != E) {
+      errs() << "\'" << *I << ":'";
+      ++I;
     }
+    for (; I != E; ++I) 
+      errs() << ", \'" << *I << ":'";
 
     errs() << '\n';
     return true;





More information about the llvm-commits mailing list