diff options
author | Vedant Kumar <vsk@apple.com> | 2015-12-18 02:27:52 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2015-12-18 02:27:52 +0000 |
commit | a1e51fd96828e52ab8c79fc0393bb098595a7700 (patch) | |
tree | f43a33648c44d1ad73eabe1ac07df7895520969a | |
parent | 277dc3f4d551be461420b0d0bd5b2b312368c6a5 (diff) | |
download | bcm5719-llvm-a1e51fd96828e52ab8c79fc0393bb098595a7700.tar.gz bcm5719-llvm-a1e51fd96828e52ab8c79fc0393bb098595a7700.zip |
[Option] Introduce Arg::print(raw_ostream&) and use llvm::dbgs
llvm-svn: 255977
-rw-r--r-- | llvm/include/llvm/Option/Arg.h | 3 | ||||
-rw-r--r-- | llvm/lib/Option/Arg.cpp | 21 |
2 files changed, 15 insertions, 9 deletions
diff --git a/llvm/include/llvm/Option/Arg.h b/llvm/include/llvm/Option/Arg.h index e1b72b6267c..f56ef080dcf 100644 --- a/llvm/include/llvm/Option/Arg.h +++ b/llvm/include/llvm/Option/Arg.h @@ -18,6 +18,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Option/Option.h" +#include "llvm/Support/raw_ostream.h" #include <string> namespace llvm { @@ -113,6 +114,8 @@ public: /// when rendered as a input (e.g., Xlinker). void renderAsInput(const ArgList &Args, ArgStringList &Output) const; + void print(raw_ostream &OS) const; + void dump() const; /// \brief Return a formatted version of the argument and diff --git a/llvm/lib/Option/Arg.cpp b/llvm/lib/Option/Arg.cpp index ac000736c1f..b14493d7dd7 100644 --- a/llvm/lib/Option/Arg.cpp +++ b/llvm/lib/Option/Arg.cpp @@ -12,7 +12,7 @@ #include "llvm/ADT/Twine.h" #include "llvm/Option/ArgList.h" #include "llvm/Option/Option.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/Debug.h" using namespace llvm; using namespace llvm::opt; @@ -43,21 +43,24 @@ Arg::~Arg() { } } -void Arg::dump() const { - llvm::errs() << "<"; +void Arg::print(raw_ostream &OS) const { + OS << "<"; - llvm::errs() << " Opt:"; + OS << " Opt:"; Opt.dump(); - llvm::errs() << " Index:" << Index; + OS << " Index:" << Index; - llvm::errs() << " Values: ["; + OS << " Values: ["; for (unsigned i = 0, e = Values.size(); i != e; ++i) { - if (i) llvm::errs() << ", "; - llvm::errs() << "'" << Values[i] << "'"; + OS << "'" << Values[i] << "'"; + if (i != e - 1) llvm::errs() << ", "; } + OS << "]>\n"; +} - llvm::errs() << "]>\n"; +void Arg::dump() const { + print(llvm::dbgs()); } std::string Arg::getAsString(const ArgList &Args) const { |