summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-doc
diff options
context:
space:
mode:
authorJulie Hockett <juliehockett@google.com>2019-07-02 17:57:11 +0000
committerJulie Hockett <juliehockett@google.com>2019-07-02 17:57:11 +0000
commitd42f22997e4b74badf62bf7cdbcb74eb091ba5ce (patch)
tree6337cb2869e647fba90521d00b17abb40625bc91 /clang-tools-extra/clang-doc
parentcffbaa93b72b307904935c380f90d49d00c7ecdc (diff)
downloadbcm5719-llvm-d42f22997e4b74badf62bf7cdbcb74eb091ba5ce.tar.gz
bcm5719-llvm-d42f22997e4b74badf62bf7cdbcb74eb091ba5ce.zip
[clang-doc] Fix segfault in comment sorting
Differential Revision: https://reviews.llvm.org/D63962 llvm-svn: 364949
Diffstat (limited to 'clang-tools-extra/clang-doc')
-rw-r--r--clang-tools-extra/clang-doc/Representation.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang-tools-extra/clang-doc/Representation.h b/clang-tools-extra/clang-doc/Representation.h
index c1f3fd484d9..a142bba8827 100644
--- a/clang-tools-extra/clang-doc/Representation.h
+++ b/clang-tools-extra/clang-doc/Representation.h
@@ -75,15 +75,16 @@ struct CommentInfo {
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>
OpenPOWER on IntegriCloud