[llvm] r298844 - Correct OptionCategoryCompare() in the command line library.
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 27 06:43:24 PDT 2017
Author: dsanders
Date: Mon Mar 27 08:43:24 2017
New Revision: 298844
URL: http://llvm.org/viewvc/llvm-project?rev=298844&view=rev
Log:
Correct OptionCategoryCompare() in the command line library.
Summary:
It should return <0, 0, or >0 for less-than, equal, and greater-than like
strcmp() (according to the history, it used to be implemented with
strcmp()) but it actually returned 0, or 1 for not-equal and equal.
Reviewers: qcolombet
Reviewed By: qcolombet
Subscribers: qcolombet, llvm-commits
Differential Revision: https://reviews.llvm.org/D30996
Modified:
llvm/trunk/lib/Support/CommandLine.cpp
Modified: llvm/trunk/lib/Support/CommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=298844&r1=298843&r2=298844&view=diff
==============================================================================
--- llvm/trunk/lib/Support/CommandLine.cpp (original)
+++ llvm/trunk/lib/Support/CommandLine.cpp Mon Mar 27 08:43:24 2017
@@ -1852,10 +1852,11 @@ public:
// Helper function for printOptions().
// It shall return a negative value if A's name should be lexicographically
- // ordered before B's name. It returns a value greater equal zero otherwise.
+ // ordered before B's name. It returns a value greater than zero if B's name
+ // should be ordered before A's name, and it returns 0 otherwise.
static int OptionCategoryCompare(OptionCategory *const *A,
OptionCategory *const *B) {
- return (*A)->getName() == (*B)->getName();
+ return (*A)->getName().compare((*B)->getName());
}
// Make sure we inherit our base class's operator=()
More information about the llvm-commits
mailing list