[cfe-commits] r66756 - /cfe/trunk/include/clang/Driver/Arg.h

Daniel Dunbar daniel at zuster.org
Wed Mar 11 18:32:10 PDT 2009


Author: ddunbar
Date: Wed Mar 11 20:32:10 2009
New Revision: 66756

URL: http://llvm.org/viewvc/llvm-project?rev=66756&view=rev
Log:
Driver: Add default index (=0) for Arg::getValue and add Arg::claim
(will be used to emit "command line argument unused" diagnostics).

Modified:
    cfe/trunk/include/clang/Driver/Arg.h

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

==============================================================================
--- cfe/trunk/include/clang/Driver/Arg.h (original)
+++ cfe/trunk/include/clang/Driver/Arg.h Wed Mar 11 20:32:10 2009
@@ -53,6 +53,11 @@
     /// ArgList.
     unsigned Index;
 
+    /// Flag indicating whether this argument was used to effect
+    /// compilation; used for generating "argument unused"
+    /// diagnostics.
+    bool Claimed;
+
   protected:
     Arg(ArgClass Kind, const Option *Opt, unsigned Index);
     
@@ -67,11 +72,17 @@
     unsigned getIndex() const { return Index; }
 
     virtual unsigned getNumValues() const = 0;
-    virtual const char *getValue(const ArgList &Args, unsigned N) const = 0;
+    virtual const char *getValue(const ArgList &Args, unsigned N=0) const = 0;
     
     /// render - Append the argument onto the given array as strings.
     virtual void render(const ArgList &Args, ArgStringList &Output) const = 0;
 
+    /// claim - Set the Arg claimed bit.
+    
+    // FIXME: We need to deal with derived arguments and set the bit
+    // in the original argument; not the derived one.
+    void claim() { Claimed = true; }
+
     static bool classof(const Arg *) { return true; }    
 
     void dump() const;
@@ -85,7 +96,7 @@
     virtual void render(const ArgList &Args, ArgStringList &Output) const;
 
     virtual unsigned getNumValues() const { return 0; }
-    virtual const char *getValue(const ArgList &Args, unsigned N) const;
+    virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
 
     static bool classof(const Arg *A) { 
       return A->getKind() == Arg::FlagClass; 
@@ -101,7 +112,7 @@
     virtual void render(const ArgList &Args, ArgStringList &Output) const;
 
     virtual unsigned getNumValues() const { return 1; }
-    virtual const char *getValue(const ArgList &Args, unsigned N) const;
+    virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
 
     static bool classof(const Arg *A) { 
       return A->getKind() == Arg::PositionalClass; 
@@ -118,7 +129,7 @@
     virtual void render(const ArgList &Args, ArgStringList &Output) const;
 
     virtual unsigned getNumValues() const { return 1; }
-    virtual const char *getValue(const ArgList &Args, unsigned N) const;
+    virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
 
     static bool classof(const Arg *A) { 
       return A->getKind() == Arg::JoinedClass; 
@@ -137,7 +148,7 @@
     virtual void render(const ArgList &Args, ArgStringList &Output) const;
 
     virtual unsigned getNumValues() const { return NumValues; }
-    virtual const char *getValue(const ArgList &Args, unsigned N) const;
+    virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
 
     static bool classof(const Arg *A) { 
       return A->getKind() == Arg::SeparateClass; 
@@ -160,7 +171,7 @@
     virtual void render(const ArgList &Args, ArgStringList &Output) const;
 
     virtual unsigned getNumValues() const { return Values.size(); }
-    virtual const char *getValue(const ArgList &Args, unsigned N) const;
+    virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
 
     static bool classof(const Arg *A) { 
       return A->getKind() == Arg::CommaJoinedClass; 
@@ -177,7 +188,7 @@
     virtual void render(const ArgList &Args, ArgStringList &Output) const;
 
     virtual unsigned getNumValues() const { return 2; }
-    virtual const char *getValue(const ArgList &Args, unsigned N) const;
+    virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
 
     static bool classof(const Arg *A) { 
       return A->getKind() == Arg::JoinedAndSeparateClass; 





More information about the cfe-commits mailing list