[cfe-commits] r66066 - in /cfe/trunk: include/clang/Driver/Option.h lib/Driver/Option.cpp

Daniel Dunbar daniel at zuster.org
Wed Mar 4 12:53:00 PST 2009


Author: ddunbar
Date: Wed Mar  4 14:53:00 2009
New Revision: 66066

URL: http://llvm.org/viewvc/llvm-project?rev=66066&view=rev
Log:
Driver: Tweak Option::accept interface.

Modified:
    cfe/trunk/include/clang/Driver/Option.h
    cfe/trunk/lib/Driver/Option.cpp

Modified: cfe/trunk/include/clang/Driver/Option.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Option.h?rev=66066&r1=66065&r2=66066&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/Option.h (original)
+++ cfe/trunk/include/clang/Driver/Option.h Wed Mar  4 14:53:00 2009
@@ -94,7 +94,7 @@
     /// argument.
     ///
     /// May issue a missing argument error.
-    virtual Arg *accept(ArgList &Args, unsigned Index) const = 0;
+    virtual Arg *accept(const ArgList &Args, unsigned &Index) const = 0;
     
     void dump() const;
 
@@ -107,7 +107,7 @@
   public:
     OptionGroup(const char *Name, const OptionGroup *Group);
 
-    virtual Arg *accept(ArgList &Args, unsigned Index) const;
+    virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
 
     static bool classof(const Option *O) { 
       return O->getKind() == Option::GroupClass; 
@@ -122,7 +122,7 @@
   public:
     InputOption();
 
-    virtual Arg *accept(ArgList &Args, unsigned Index) const;
+    virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
 
     static bool classof(const Option *O) { 
       return O->getKind() == Option::InputClass; 
@@ -135,7 +135,7 @@
   public:
     UnknownOption();
 
-    virtual Arg *accept(ArgList &Args, unsigned Index) const;
+    virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
 
     static bool classof(const Option *O) { 
       return O->getKind() == Option::UnknownClass; 
@@ -149,7 +149,7 @@
   public:
     FlagOption(const char *Name, const OptionGroup *Group, const Option *Alias);
 
-    virtual Arg *accept(ArgList &Args, unsigned Index) const;
+    virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
 
     static bool classof(const Option *O) { 
       return O->getKind() == Option::FlagClass; 
@@ -162,7 +162,7 @@
     JoinedOption(const char *Name, const OptionGroup *Group, 
                  const Option *Alias);
 
-    virtual Arg *accept(ArgList &Args, unsigned Index) const;
+    virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
 
     static bool classof(const Option *O) { 
       return O->getKind() == Option::JoinedClass; 
@@ -175,7 +175,7 @@
     SeparateOption(const char *Name, const OptionGroup *Group, 
                    const Option *Alias);
 
-    virtual Arg *accept(ArgList &Args, unsigned Index) const;
+    virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
 
     static bool classof(const Option *O) { 
       return O->getKind() == Option::SeparateClass; 
@@ -188,7 +188,7 @@
     CommaJoinedOption(const char *Name, const OptionGroup *Group, 
                       const Option *Alias);
 
-    virtual Arg *accept(ArgList &Args, unsigned Index) const;
+    virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
 
     static bool classof(const Option *O) { 
       return O->getKind() == Option::CommaJoinedClass; 
@@ -196,6 +196,8 @@
     static bool classof(const CommaJoinedOption *) { return true; }
   };
 
+  // FIXME: Fold MultiArgOption into SeparateOption?
+
   /// MultiArgOption - An option which takes multiple arguments (these
   /// are always separate arguments).
   class MultiArgOption : public Option {
@@ -207,7 +209,7 @@
 
     unsigned getNumArgs() const { return NumArgs; }
 
-    virtual Arg *accept(ArgList &Args, unsigned Index) const;
+    virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
 
     static bool classof(const Option *O) { 
       return O->getKind() == Option::MultiArgClass; 
@@ -222,7 +224,7 @@
     JoinedOrSeparateOption(const char *Name, const OptionGroup *Group, 
                            const Option *Alias);
 
-    virtual Arg *accept(ArgList &Args, unsigned Index) const;
+    virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
 
     static bool classof(const Option *O) { 
       return O->getKind() == Option::JoinedOrSeparateClass; 
@@ -237,7 +239,7 @@
     JoinedAndSeparateOption(const char *Name, const OptionGroup *Group, 
                             const Option *Alias);
 
-    virtual Arg *accept(ArgList &Args, unsigned Index) const;
+    virtual Arg *accept(const ArgList &Args, unsigned &Index) const;
 
     static bool classof(const Option *O) { 
       return O->getKind() == Option::JoinedAndSeparateClass; 

Modified: cfe/trunk/lib/Driver/Option.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Option.cpp?rev=66066&r1=66065&r2=66066&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Option.cpp (original)
+++ cfe/trunk/lib/Driver/Option.cpp Wed Mar  4 14:53:00 2009
@@ -83,7 +83,7 @@
   : Option(Option::GroupClass, Name, Group, 0) {
 }
 
-Arg *OptionGroup::accept(ArgList &Args, unsigned Index) const {
+Arg *OptionGroup::accept(const ArgList &Args, unsigned &Index) const {
   assert(0 && "FIXME");
   return 0;
 }
@@ -92,7 +92,7 @@
   : Option(Option::InputClass, "<input>", 0, 0) {
 }
 
-Arg *InputOption::accept(ArgList &Args, unsigned Index) const {
+Arg *InputOption::accept(const ArgList &Args, unsigned &Index) const {
   assert(0 && "FIXME");
   return 0;
 }
@@ -101,7 +101,7 @@
   : Option(Option::UnknownClass, "<unknown>", 0, 0) {
 }
 
-Arg *UnknownOption::accept(ArgList &Args, unsigned Index) const {
+Arg *UnknownOption::accept(const ArgList &Args, unsigned &Index) const {
   assert(0 && "FIXME");
   return 0;
 }
@@ -111,7 +111,7 @@
   : Option(Option::FlagClass, Name, Group, Alias) {
 }
 
-Arg *FlagOption::accept(ArgList &Args, unsigned Index) const {
+Arg *FlagOption::accept(const ArgList &Args, unsigned &Index) const {
   assert(0 && "FIXME");
   return 0;
 }
@@ -121,7 +121,7 @@
   : Option(Option::JoinedClass, Name, Group, Alias) {
 }
 
-Arg *JoinedOption::accept(ArgList &Args, unsigned Index) const {
+Arg *JoinedOption::accept(const ArgList &Args, unsigned &Index) const {
   assert(0 && "FIXME");
   return 0;
 }
@@ -131,7 +131,7 @@
   : Option(Option::CommaJoinedClass, Name, Group, Alias) {
 }
 
-Arg *CommaJoinedOption::accept(ArgList &Args, unsigned Index) const {
+Arg *CommaJoinedOption::accept(const ArgList &Args, unsigned &Index) const {
   assert(0 && "FIXME");
   return 0;
 }
@@ -141,7 +141,7 @@
   : Option(Option::SeparateClass, Name, Group, Alias) {
 }
 
-Arg *SeparateOption::accept(ArgList &Args, unsigned Index) const {
+Arg *SeparateOption::accept(const ArgList &Args, unsigned &Index) const {
   assert(0 && "FIXME");
   return 0;
 }
@@ -151,7 +151,7 @@
   : Option(Option::MultiArgClass, Name, Group, Alias), NumArgs(_NumArgs) {
 }
 
-Arg *MultiArgOption::accept(ArgList &Args, unsigned Index) const {
+Arg *MultiArgOption::accept(const ArgList &Args, unsigned &Index) const {
   assert(0 && "FIXME");
   return 0;
 }
@@ -162,7 +162,7 @@
   : Option(Option::JoinedOrSeparateClass, Name, Group, Alias) {
 }
 
-Arg *JoinedOrSeparateOption::accept(ArgList &Args, unsigned Index) const {
+Arg *JoinedOrSeparateOption::accept(const ArgList &Args, unsigned &Index) const {
   assert(0 && "FIXME");
   return 0;
 }
@@ -173,7 +173,7 @@
   : Option(Option::JoinedAndSeparateClass, Name, Group, Alias) {
 }
 
-Arg *JoinedAndSeparateOption::accept(ArgList &Args, unsigned Index) const {
+Arg *JoinedAndSeparateOption::accept(const ArgList &Args, unsigned &Index) const {
   assert(0 && "FIXME");
   return 0;
 }





More information about the cfe-commits mailing list