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

Daniel Dunbar daniel at zuster.org
Wed Mar 4 15:02:50 PST 2009


Author: ddunbar
Date: Wed Mar  4 17:02:50 2009
New Revision: 66100

URL: http://llvm.org/viewvc/llvm-project?rev=66100&view=rev
Log:
Driver: Add Arg::dump and SeparateArg stubs.

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

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

==============================================================================
--- cfe/trunk/include/clang/Driver/Arg.h (original)
+++ cfe/trunk/include/clang/Driver/Arg.h Wed Mar  4 17:02:50 2009
@@ -71,6 +71,8 @@
     virtual void render(const ArgList &Args, ArgStringList &Output) const = 0;
 
     static bool classof(const Arg *) { return true; }    
+
+    void dump() const;
   };
 
   /// PositionalArg - A simple positional argument.

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

==============================================================================
--- cfe/trunk/lib/Driver/Arg.cpp (original)
+++ cfe/trunk/lib/Driver/Arg.cpp Wed Mar  4 17:02:50 2009
@@ -8,6 +8,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/Driver/Arg.h"
+#include "clang/Driver/Option.h"
+#include "llvm/Support/raw_ostream.h"
 
 using namespace clang::driver;
 
@@ -20,6 +22,33 @@
 
 Arg::~Arg() { }
 
+void Arg::dump() const {
+  llvm::errs() << "<";
+  switch (Kind) {
+  default:
+    assert(0 && "Invalid kind");
+#define P(N) case N: llvm::errs() << #N; break
+    P(PositionalClass);
+    P(JoinedClass);
+    P(SeparateClass);
+    P(CommaJoinedClass);
+    P(JoinedAndSeparateClass);
+#undef P
+  }
+
+  llvm::errs() << " Opt:";
+  Opt->dump();
+
+  llvm::errs() << " Index:" << Index;
+
+  if (const CommaJoinedArg *CJA = dyn_cast<CommaJoinedArg>(this))
+    llvm::errs() << " NumValues:" << CJA->getNumValues();
+
+  llvm::errs() << ">\n";
+
+  llvm::errs().flush(); // FIXME
+}
+
 PositionalArg::PositionalArg(const Option *Opt, unsigned Index)
   : Arg(PositionalClass, Opt, Index) {
 }
@@ -57,6 +86,18 @@
   assert(0 && "FIXME: Implement");
 }
 
+SeparateArg::SeparateArg(const Option *Opt, unsigned Index, unsigned _NumValues)
+  : Arg(SeparateClass, Opt, Index), NumValues(_NumValues) {
+}
+
+void SeparateArg::render(const ArgList &Args, ArgStringList &Output) const {
+  assert(0 && "FIXME: Implement");
+}
+
+const char *SeparateArg::getValue(const ArgList &Args, unsigned N) const { 
+  assert(0 && "FIXME: Implement");
+}
+
 JoinedAndSeparateArg::JoinedAndSeparateArg(const Option *Opt, unsigned Index)
   : Arg(JoinedAndSeparateClass, Opt, Index) {
 }





More information about the cfe-commits mailing list