diff options
author | Don Hinton <hintonda@gmail.com> | 2019-05-16 16:25:13 +0000 |
---|---|---|
committer | Don Hinton <hintonda@gmail.com> | 2019-05-16 16:25:13 +0000 |
commit | 8249a8889dbe5ef41c3367cca2d1f541b9c47081 (patch) | |
tree | 9fe3d3afdc5832c486049286fe64e24b56e7acf6 /llvm/lib/Support/CommandLine.cpp | |
parent | 600ec01b7e27e4c815e1968db4a600e63491ed19 (diff) | |
download | llvm-8249a8889dbe5ef41c3367cca2d1f541b9c47081.zip llvm-8249a8889dbe5ef41c3367cca2d1f541b9c47081.tar.gz llvm-8249a8889dbe5ef41c3367cca2d1f541b9c47081.tar.bz2 |
[CommandLine] Don't allow duplicate categories.
Summary:
This is a fix to D61574, r360179, that allowed duplicate
OptionCategory's. This change adds a check to make sure a category can
only be added once even if the user passes it twice.
Reviewed By: MaskRay
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61972
llvm-svn: 360913
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r-- | llvm/lib/Support/CommandLine.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index 4e63a07..3d82f15 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -450,7 +450,7 @@ void Option::addCategory(OptionCategory &C) { // must be explicitly added if you want multiple categories that include it. if (&C != &GeneralCategory && Categories[0] == &GeneralCategory) Categories[0] = &C; - else + else if (find(Categories, &C) == Categories.end()) Categories.push_back(&C); } |