[llvm] r291406 - CommandLine option: Relax the assertion introduced in r290467 to allows for empty string
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 8 14:30:43 PST 2017
Author: mehdi_amini
Date: Sun Jan 8 16:30:43 2017
New Revision: 291406
URL: http://llvm.org/viewvc/llvm-project?rev=291406&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Support/CommandLine.cpp
Modified: llvm/trunk/lib/Support/CommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=291406&r1=291405&r2=291406&view=diff
==============================================================================
--- llvm/trunk/lib/Support/CommandLine.cpp (original)
+++ llvm/trunk/lib/Support/CommandLine.cpp Sun Jan 8 16:30:43 2017
@@ -373,7 +373,7 @@ void Option::removeArgument() { GlobalPa
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;
}
More information about the llvm-commits
mailing list