Author: juliehockett Date: Tue Jul 2 10:57:11 2019 New Revision: 364949 URL: http://llvm.org/viewvc/llvm-project?rev=364949&view=rev Log: [clang-doc] Fix segfault in comment sorting
Differential Revision: https://reviews.llvm.org/D63962 Modified: clang-tools-extra/trunk/clang-doc/Representation.h Modified: clang-tools-extra/trunk/clang-doc/Representation.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/Representation.h?rev=364949&r1=364948&r2=364949&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-doc/Representation.h (original) +++ clang-tools-extra/trunk/clang-doc/Representation.h Tue Jul 2 10:57:11 2019 @@ -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> _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits