diff options
author | Alexander Kornienko <alexfh@google.com> | 2014-02-05 16:56:37 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2014-02-05 16:56:37 +0000 |
commit | e88421b6f70ebc33e8405a95de29ba4756731449 (patch) | |
tree | 26eb05034345c21b826cfa88603693a36bb8f7bf /llvm/include/llvm/Support/CommandLine.h | |
parent | f387387835f9f96db2924aae695b20fcf825ded5 (diff) | |
download | bcm5719-llvm-e88421b6f70ebc33e8405a95de29ba4756731449.tar.gz bcm5719-llvm-e88421b6f70ebc33e8405a95de29ba4756731449.zip |
Fix an invalid check for duplicate option categories.
Summary:
The check performed in the comparator is invalid, as some STL
implementations enforce strict weak ordering by calling the comparator with the
same value. This check was also in a wrong place: the assertion would only fire
when -help was used. The new check is performed each time the category is
registered (we are not going to have thousands of them, so it's fine to do it in
O(N^2)).
Reviewers: jordan_rose
Reviewed By: jordan_rose
CC: cfe-commits, alexmc
Differential Revision: http://llvm-reviews.chandlerc.com/D2699
llvm-svn: 200853
Diffstat (limited to 'llvm/include/llvm/Support/CommandLine.h')
-rw-r--r-- | llvm/include/llvm/Support/CommandLine.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h index 515b0bd00f9..b29fc873603 100644 --- a/llvm/include/llvm/Support/CommandLine.h +++ b/llvm/include/llvm/Support/CommandLine.h @@ -149,8 +149,8 @@ private: public: OptionCategory(const char *const Name, const char *const Description = 0) : Name(Name), Description(Description) { registerCategory(); } - const char *getName() { return Name; } - const char *getDescription() { return Description; } + const char *getName() const { return Name; } + const char *getDescription() const { return Description; } }; // The general Option Category (used as default category). |