]> granicus.if.org Git - llvm/commitdiff
CommandLine option: Relax the assertion introduced in r290467 to allows for empty...
authorMehdi Amini <mehdi.amini@apple.com>
Sun, 8 Jan 2017 22:30:43 +0000 (22:30 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Sun, 8 Jan 2017 22:30:43 +0000 (22:30 +0000)
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

lib/Support/CommandLine.cpp

index 0a989706b436177b3ba2b969c9688e206ef2fdf3..3889902eea54a208eb5bf209ac15381603d85cde 100644 (file)
@@ -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;
 }