From: Mehdi Amini Date: Sun, 8 Jan 2017 22:30:43 +0000 (+0000) Subject: CommandLine option: Relax the assertion introduced in r290467 to allows for empty... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8839e0c24030a76151a39c6098f1e6a2e39e1898;p=llvm CommandLine option: Relax the assertion introduced in r290467 to allows for empty string This is used in LDC for custom boolean commandline options, setArgStr is called with an empty string before using AddLiteralOption. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291406 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index 0a989706b43..3889902eea5 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -373,7 +373,7 @@ void Option::removeArgument() { GlobalParser->removeOption(this); } void Option::setArgStr(StringRef S) { if (FullyInitialized) GlobalParser->updateArgStr(this, S); - assert(S[0] != '-' && "Option can't start with '-"); + assert((S.empty() || S[0] != '-') && "Option can't start with '-"); ArgStr = S; }