[llvm-commits] [llvm] r68588 - in /llvm/trunk: docs/CommandLine.html include/llvm/Support/CommandLine.h lib/Support/CommandLine.cpp

Chris Lattner sabre at nondot.org
Tue Apr 7 20:43:51 PDT 2009


Author: lattner
Date: Tue Apr  7 22:43:51 2009
New Revision: 68588

URL: http://llvm.org/viewvc/llvm-project?rev=68588&view=rev
Log:
Remove AllowInverse: it leaks memory and is not the right
abstraction for CommandLine.

Modified:
    llvm/trunk/docs/CommandLine.html
    llvm/trunk/include/llvm/Support/CommandLine.h
    llvm/trunk/lib/Support/CommandLine.cpp

Modified: llvm/trunk/docs/CommandLine.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandLine.html?rev=68588&r1=68587&r2=68588&view=diff

==============================================================================
--- llvm/trunk/docs/CommandLine.html (original)
+++ llvm/trunk/docs/CommandLine.html Tue Apr  7 22:43:51 2009
@@ -1447,17 +1447,6 @@
 error. As with <b><tt>cl::CommaSeparated</tt></b></a>, this modifier
 only makes sense with a <a href="#cl::list">cl::list</a> option.</li>
 
-<li><a name="cl::AllowInverse">The <b><tt>cl::AllowInverse</tt></b></a>
-modifier can be used on options that have the form <tt>-fopt</tt> to
-automatically create a corresponding
-<tt>-fno-opt</tt> option.  The <tt>f</tt> can be any single
-character, and the <tt>opt</tt> can be any one or more characters.
-The value of the created option is the logical complement of the value
-that would have been used if the base form of the option was used.
-This modifier only makes sense with an option that uses
-a <a href="#boolparser">bool parser</a>.</li>
-
-
 </ul>
 
 <p>So far, these are the only three miscellaneous option modifiers.</p>
@@ -1755,11 +1744,7 @@
 <li><a name="boolparser">The <b><tt>parser<bool></tt> specialization</b></a>
 is used to convert boolean strings to a boolean value.  Currently accepted
 strings are "<tt>true</tt>", "<tt>TRUE</tt>", "<tt>True</tt>", "<tt>1</tt>",
-"<tt>false</tt>", "<tt>FALSE</tt>", "<tt>False</tt>", and "<tt>0</tt>".  The
-<b><tt>cl::AllowInverse</tt></b> modifier can be used on an option of the form
-<tt>-fopt</tt> that uses the <tt>parser<bool></tt> specialization
-to create a corresponding option with the form <tt>-fno-opt</tt>.  See
-<a href="#cl::AllowInverse"><tt>cl::AllowInverse</tt></a> for details.</li>
+"<tt>false</tt>", "<tt>FALSE</tt>", "<tt>False</tt>", and "<tt>0</tt>".</li>
 
 <li><a name="boolOrDefaultparser">The <b><tt>parser<boolOrDefault></tt>
  specialization</b></a> is used for cases where the value is boolean,

Modified: llvm/trunk/include/llvm/Support/CommandLine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CommandLine.h?rev=68588&r1=68587&r2=68588&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/CommandLine.h (original)
+++ llvm/trunk/include/llvm/Support/CommandLine.h Tue Apr  7 22:43:51 2009
@@ -127,8 +127,7 @@
   CommaSeparated     = 0x200,  // Should this cl::list split between commas?
   PositionalEatsArgs = 0x400,  // Should this positional cl::list eat -args?
   Sink               = 0x800,  // Should this cl::list eat all unknown options?
-  AllowInverse	     = 0x1000, // Can this option take a -Xno- form?
-  MiscMask           = 0x1E00  // Union of the above flags.
+  MiscMask           = 0xE00   // Union of the above flags.
 };
 
 
@@ -538,17 +537,14 @@
 //
 template<>
 class parser<bool> : public basic_parser<bool> {
-  bool IsInvertible;	// Should we synthesize a -xno- style option?
   const char *ArgStr;
 public:
-  void getExtraOptionNames(std::vector<const char*> &OptionNames);
   
   // parse - Return true on error.
   bool parse(Option &O, const char *ArgName, const std::string &Arg, bool &Val);
 
   template <class Opt>
   void initialize(Opt &O) {
-    IsInvertible = (O.getMiscFlags() & llvm::cl::AllowInverse);
     ArgStr = O.ArgStr;
   }
 

Modified: llvm/trunk/lib/Support/CommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=68588&r1=68587&r2=68588&view=diff

==============================================================================
--- llvm/trunk/lib/Support/CommandLine.cpp (original)
+++ llvm/trunk/lib/Support/CommandLine.cpp Tue Apr  7 22:43:51 2009
@@ -872,30 +872,9 @@
     return O.error(": '" + Arg +
                    "' is invalid value for boolean argument! Try 0 or 1");
   }
-  if (IsInvertible && strncmp(ArgName+1, "no-", 3) == 0)
-    Value = !Value;
   return false;
 }
 
-void parser<bool>::getExtraOptionNames(std::vector<const char*> &OptionNames) {
-  if (!IsInvertible)
-    return;
-  
-  char *s = new char [strlen(ArgStr) + 3 + 1];
-  s[0] = ArgStr[0];
-  if (strncmp(ArgStr+1, "no-", 3) == 0)
-    strcpy(&s[1], &ArgStr[4]);
-  else {
-    s[1] = 'n';
-    s[2] = 'o';
-    s[3] = '-';
-    strcpy(&s[4], ArgStr+1);
-  }
-  OptionNames.push_back(s);
-}
-
-
-
 // parser<boolOrDefault> implementation
 //
 bool parser<boolOrDefault>::parse(Option &O, const char *ArgName,





More information about the llvm-commits mailing list