llvm.org GIT mirror llvm / 1b47315
[CommandLine] Enable Grouping for short options by default. Part 4 of 5 Summary: This change enables `cl::Grouping` for short options -- options with names of a single character. This is consistent with GNU getopt behavior. Reviewers: rnk, MaskRay Reviewed By: MaskRay Subscribers: thopre, cfe-commits, MaskRay, rupprecht, hiraditya, llvm-commits Tags: #llvm, #clang Differential Revision: https://reviews.llvm.org/D61270 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359917 91177308-0d34-0410-b5e6-96231b3b80d8 Don Hinton 1 year, 5 months ago
3 changed file(s) with 8 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
11991199 };
12001200
12011201 template <> struct applicator {
1202 static void opt(MiscFlags MF, Option &O) { O.setMiscFlag(MF); }
1202 static void opt(MiscFlags MF, Option &O) {
1203 assert((MF != Grouping || O.ArgStr.size() == 1) &&
1204 "cl::Grouping can only apply to single charater Options.");
1205 O.setMiscFlag(MF);
1206 }
12031207 };
12041208
12051209 // apply method - Apply modifiers to an option in a type safe way.
420420 GlobalParser->updateArgStr(this, S);
421421 assert((S.empty() || S[0] != '-') && "Option can't start with '-");
422422 ArgStr = S;
423 if (ArgStr.size() == 1)
424 setMiscFlag(Grouping);
423425 }
424426
425427 void Option::reset() {
99 RUN: not llvm-readobj -aeWhSrnudlVgIs %p/Inputs/trivial.obj.elf-i386 2>&1 | FileCheck %s --check-prefix=UNKNOWN
1010
1111 CHECK-NOT: Unknown command line argument
12 UNKNOWN: Unknown command line argument
12 UNKNOWN: for the --section-headers option: may only occur zero or one times!