Index: llvm/trunk/include/llvm/Support/CommandLine.h =================================================================== --- llvm/trunk/include/llvm/Support/CommandLine.h +++ llvm/trunk/include/llvm/Support/CommandLine.h @@ -1200,7 +1200,11 @@ }; template <> struct applicator { - 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. Index: llvm/trunk/lib/Support/CommandLine.cpp =================================================================== --- llvm/trunk/lib/Support/CommandLine.cpp +++ llvm/trunk/lib/Support/CommandLine.cpp @@ -421,6 +421,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/trunk/test/tools/llvm-readobj/merged.test =================================================================== --- llvm/trunk/test/tools/llvm-readobj/merged.test +++ llvm/trunk/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!