summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorDaniel Sanders <daniel_l_sanders@apple.com>2017-03-27 13:43:24 +0000
committerDaniel Sanders <daniel_l_sanders@apple.com>2017-03-27 13:43:24 +0000
commit513c3e474d9e9ade4c5e232fdfd4bb962c26cab5 (patch)
tree3908b5b02d30b473b588f22b8b54ba99d6b4e05f /llvm/lib/Support/CommandLine.cpp
parent0848b23d5350ee5a28ffcee6bf51b440133cfa98 (diff)
downloadbcm5719-llvm-513c3e474d9e9ade4c5e232fdfd4bb962c26cab5.tar.gz
bcm5719-llvm-513c3e474d9e9ade4c5e232fdfd4bb962c26cab5.zip
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 llvm-svn: 298844
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r--llvm/lib/Support/CommandLine.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index 65747d69291..f4a9108b854 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -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=()
OpenPOWER on IntegriCloud