[llvm] r290467 - Add an assertion for cl::opt names: they can't start with '-'

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 23 15:55:26 PST 2016


Author: mehdi_amini
Date: Fri Dec 23 17:55:26 2016
New Revision: 290467

URL: http://llvm.org/viewvc/llvm-project?rev=290467&view=rev
Log:
Add an assertion for cl::opt names: they can't start with '-'

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=290467&r1=290466&r2=290467&view=diff
==============================================================================
--- llvm/trunk/lib/Support/CommandLine.cpp (original)
+++ llvm/trunk/lib/Support/CommandLine.cpp Fri Dec 23 17:55:26 2016
@@ -373,6 +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 '-");
   ArgStr = S;
 }
 




More information about the llvm-commits mailing list