[PATCH] D61270: [CommandLine] Enable Grouping for short options by default. Part 4 of 5
Don Hinton via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 29 16:42:48 PDT 2019
hintonda updated this revision to Diff 197220.
hintonda added a comment.
Herald added a subscriber: rupprecht.
- Fix test error message.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61270/new/
https://reviews.llvm.org/D61270
Files:
llvm/include/llvm/Support/CommandLine.h
llvm/lib/Support/CommandLine.cpp
llvm/test/tools/llvm-readobj/merged.test
Index: llvm/test/tools/llvm-readobj/merged.test
===================================================================
--- llvm/test/tools/llvm-readobj/merged.test
+++ llvm/test/tools/llvm-readobj/merged.test
@@ -10,4 +10,4 @@
RUN: not llvm-readobj -aeWhSrnudlVgIs %p/Inputs/trivial.obj.elf-i386 2>&1 | FileCheck %s --check-prefix=UNKNOWN
CHECK-NOT: Unknown command line argument
-UNKNOWN: Unknown command line argument
+UNKNOWN: for the -section-headers option: may only occur zero or one times!
Index: llvm/lib/Support/CommandLine.cpp
===================================================================
--- llvm/lib/Support/CommandLine.cpp
+++ llvm/lib/Support/CommandLine.cpp
@@ -392,6 +392,8 @@
GlobalParser->updateArgStr(this, S);
assert((S.empty() || S[0] != '-') && "Option can't start with '-");
ArgStr = S;
+ if (ArgStr.size() == 1)
+ setMiscFlag(Grouping);
}
void Option::reset() {
Index: llvm/include/llvm/Support/CommandLine.h
===================================================================
--- llvm/include/llvm/Support/CommandLine.h
+++ llvm/include/llvm/Support/CommandLine.h
@@ -1205,7 +1205,11 @@
};
template <> struct applicator<MiscFlags> {
- static void opt(MiscFlags MF, Option &O) { O.setMiscFlag(MF); }
+ static void opt(MiscFlags MF, Option &O) {
+ assert((MF != Grouping || O.ArgStr.size() == 1) &&
+ "cl::Grouping can only apply to single charater Options.");
+ O.setMiscFlag(MF);
+ }
};
// apply method - Apply modifiers to an option in a type safe way.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61270.197220.patch
Type: text/x-patch
Size: 1536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190429/e32d3dd1/attachment.bin>
More information about the llvm-commits
mailing list