]> granicus.if.org Git - clang/commitdiff
[analyzer] Remove comparePath's dependency on subscript operator.
authorTed Kremenek <kremenek@apple.com>
Mon, 29 Apr 2013 22:38:22 +0000 (22:38 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 29 Apr 2013 22:38:22 +0000 (22:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180740 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/PathDiagnostic.cpp

index a30d871d8f534377b45ad61669a5b071ad3b219a..03513106ecd31bd5248fb4c03ab7e8dcc44e3392 100644 (file)
@@ -297,11 +297,16 @@ static Optional<bool> comparePiece(const PathDiagnosticPiece &X,
 static Optional<bool> comparePath(const PathPieces &X, const PathPieces &Y) {
   if (X.size() != Y.size())
     return X.size() < Y.size();
-  for (unsigned i = 0, n = X.size(); i != n; ++i) {
-    Optional<bool> b = comparePiece(*X[i], *Y[i]);
+
+  PathPieces::const_iterator X_I = X.begin(), X_end = X.end();
+  PathPieces::const_iterator Y_I = Y.begin(), Y_end = Y.end();
+
+  for ( ; X_I != X_end && Y_I != Y_end; ++X_I, ++Y_I) {
+    Optional<bool> b = comparePiece(**X_I, **Y_I);
     if (b.hasValue())
       return b.getValue();
   }
+
   return None;
 }