juliehockett created this revision.
juliehockett added a reviewer: jakehehrlich.
juliehockett added a project: clang-tools-extra.

https://reviews.llvm.org/D63962

Files:
  clang-tools-extra/clang-doc/Representation.h


Index: clang-tools-extra/clang-doc/Representation.h
===================================================================
--- clang-tools-extra/clang-doc/Representation.h
+++ clang-tools-extra/clang-doc/Representation.h
@@ -75,15 +75,16 @@
                  Other.ParamName, Other.CloseName, Other.SelfClosing,
                  Other.Explicit, Other.AttrKeys, Other.AttrValues, Other.Args);
 
-    if (FirstCI < SecondCI ||
-        (FirstCI == SecondCI && Children.size() < Other.Children.size()))
+    if (FirstCI < SecondCI)
       return true;
 
-    if (FirstCI > SecondCI || Children.size() > Other.Children.size())
-      return false;
+    if (FirstCI == SecondCI) {
+      return std::lexicographical_compare(
+          Children.begin(), Children.end(), Other.Children.begin(),
+          Other.Children.end(), llvm::deref<llvm::less>());
+    }
 
-    return std::equal(Children.begin(), Children.end(), Other.Children.begin(),
-                      llvm::deref<llvm::less>{});
+    return false;
   }
 
   SmallString<16>


Index: clang-tools-extra/clang-doc/Representation.h
===================================================================
--- clang-tools-extra/clang-doc/Representation.h
+++ clang-tools-extra/clang-doc/Representation.h
@@ -75,15 +75,16 @@
                  Other.ParamName, Other.CloseName, Other.SelfClosing,
                  Other.Explicit, Other.AttrKeys, Other.AttrValues, Other.Args);
 
-    if (FirstCI < SecondCI ||
-        (FirstCI == SecondCI && Children.size() < Other.Children.size()))
+    if (FirstCI < SecondCI)
       return true;
 
-    if (FirstCI > SecondCI || Children.size() > Other.Children.size())
-      return false;
+    if (FirstCI == SecondCI) {
+      return std::lexicographical_compare(
+          Children.begin(), Children.end(), Other.Children.begin(),
+          Other.Children.end(), llvm::deref<llvm::less>());
+    }
 
-    return std::equal(Children.begin(), Children.end(), Other.Children.begin(),
-                      llvm::deref<llvm::less>{});
+    return false;
   }
 
   SmallString<16>
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D63962: [clang-doc] ... Julie Hockett via Phabricator via cfe-commits

Reply via email to