Convert Arg, ArgList, and Option to dump() to dbgs() rather than errs().
[oota-llvm.git] / include / llvm / Option / Arg.h
index 6b8ed3f7d2b114d65f98c3a10c9cfb589f836b51..99d329693de2e7888bcd979d5055f8b0a26660ff 100644 (file)
@@ -27,13 +27,10 @@ class ArgList;
 /// \brief A concrete instance of a particular driver option.
 ///
 /// The Arg class encodes just enough information to be able to
-/// derive the argument values efficiently. In addition, Arg
-/// instances have an intrusive double linked list which is used by
-/// ArgList to provide efficient iteration over all instances of a
-/// particular option.
+/// derive the argument values efficiently.
 class Arg {
-  Arg(const Arg &) LLVM_DELETED_FUNCTION;
-  void operator=(const Arg &) LLVM_DELETED_FUNCTION;
+  Arg(const Arg &) = delete;
+  void operator=(const Arg &) = delete;
 
 private:
   /// \brief The option this argument is an instance of.
@@ -63,14 +60,14 @@ private:
 
 public:
   Arg(const Option Opt, StringRef Spelling, unsigned Index,
-      const Arg *BaseArg = 0);
+      const Arg *BaseArg = nullptr);
   Arg(const Option Opt, StringRef Spelling, unsigned Index,
-      const char *Value0, const Arg *BaseArg = 0);
+      const char *Value0, const Arg *BaseArg = nullptr);
   Arg(const Option Opt, StringRef Spelling, unsigned Index,
-      const char *Value0, const char *Value1, const Arg *BaseArg = 0);
+      const char *Value0, const char *Value1, const Arg *BaseArg = nullptr);
   ~Arg();
 
-  const Option getOption() const { return Opt; }
+  const Option &getOption() const { return Opt; }
   StringRef getSpelling() const { return Spelling; }
   unsigned getIndex() const { return Index; }
 
@@ -81,9 +78,7 @@ public:
   const Arg &getBaseArg() const {
     return BaseArg ? *BaseArg : *this;
   }
-  void setBaseArg(const Arg *_BaseArg) {
-    BaseArg = _BaseArg;
-  }
+  void setBaseArg(const Arg *BaseArg) { this->BaseArg = BaseArg; }
 
   bool getOwnsValues() const { return OwnsValues; }
   void setOwnsValues(bool Value) const { OwnsValues = Value; }
@@ -98,9 +93,8 @@ public:
     return Values[N];
   }
 
-  SmallVectorImpl<const char*> &getValues() {
-    return Values;
-  }
+  SmallVectorImpl<const char *> &getValues() { return Values; }
+  const SmallVectorImpl<const char *> &getValues() const { return Values; }
 
   bool containsValue(StringRef Value) const {
     for (unsigned i = 0, e = getNumValues(); i != e; ++i)
@@ -119,6 +113,7 @@ public:
   /// when rendered as a input (e.g., Xlinker).
   void renderAsInput(const ArgList &Args, ArgStringList &Output) const;
 
+  void print(raw_ostream &O) const;
   void dump() const;
 
   /// \brief Return a formatted version of the argument and