mirror of
https://github.com/RPCSX/llvm.git
synced 2025-04-11 20:52:31 +00:00
Convert Arg, ArgList, and Option to dump() to dbgs() rather than errs().
Also add print() functions. Patch by Justin Lebar! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256010 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8281fa7838
commit
96e80fcbfd
@ -113,6 +113,7 @@ public:
|
|||||||
/// when rendered as a input (e.g., Xlinker).
|
/// when rendered as a input (e.g., Xlinker).
|
||||||
void renderAsInput(const ArgList &Args, ArgStringList &Output) const;
|
void renderAsInput(const ArgList &Args, ArgStringList &Output) const;
|
||||||
|
|
||||||
|
void print(raw_ostream &O) const;
|
||||||
void dump() const;
|
void dump() const;
|
||||||
|
|
||||||
/// \brief Return a formatted version of the argument and
|
/// \brief Return a formatted version of the argument and
|
||||||
|
@ -306,6 +306,7 @@ public:
|
|||||||
const char *GetOrMakeJoinedArgString(unsigned Index, StringRef LHS,
|
const char *GetOrMakeJoinedArgString(unsigned Index, StringRef LHS,
|
||||||
StringRef RHS) const;
|
StringRef RHS) const;
|
||||||
|
|
||||||
|
void print(raw_ostream &O) const;
|
||||||
void dump() const;
|
void dump() const;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
@ -195,6 +195,7 @@ public:
|
|||||||
/// start.
|
/// start.
|
||||||
Arg *accept(const ArgList &Args, unsigned &Index, unsigned ArgSize) const;
|
Arg *accept(const ArgList &Args, unsigned &Index, unsigned ArgSize) const;
|
||||||
|
|
||||||
|
void print(raw_ostream &O) const;
|
||||||
void dump() const;
|
void dump() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "llvm/Option/ArgList.h"
|
#include "llvm/Option/ArgList.h"
|
||||||
#include "llvm/Option/Option.h"
|
#include "llvm/Option/Option.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
#include "llvm/Support/Debug.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace llvm::opt;
|
using namespace llvm::opt;
|
||||||
@ -43,23 +44,25 @@ Arg::~Arg() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Arg::dump() const {
|
void Arg::print(raw_ostream& O) const {
|
||||||
llvm::errs() << "<";
|
O << "<";
|
||||||
|
|
||||||
llvm::errs() << " Opt:";
|
O << " Opt:";
|
||||||
Opt.dump();
|
Opt.print(O);
|
||||||
|
|
||||||
llvm::errs() << " Index:" << Index;
|
O << " Index:" << Index;
|
||||||
|
|
||||||
llvm::errs() << " Values: [";
|
O << " Values: [";
|
||||||
for (unsigned i = 0, e = Values.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Values.size(); i != e; ++i) {
|
||||||
if (i) llvm::errs() << ", ";
|
if (i) O << ", ";
|
||||||
llvm::errs() << "'" << Values[i] << "'";
|
O << "'" << Values[i] << "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::errs() << "]>\n";
|
O << "]>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLVM_DUMP_METHOD void Arg::dump() const { print(dbgs()); }
|
||||||
|
|
||||||
std::string Arg::getAsString(const ArgList &Args) const {
|
std::string Arg::getAsString(const ArgList &Args) const {
|
||||||
SmallString<256> Res;
|
SmallString<256> Res;
|
||||||
llvm::raw_svector_ostream OS(Res);
|
llvm::raw_svector_ostream OS(Res);
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "llvm/ADT/Twine.h"
|
#include "llvm/ADT/Twine.h"
|
||||||
#include "llvm/Option/Arg.h"
|
#include "llvm/Option/Arg.h"
|
||||||
#include "llvm/Option/Option.h"
|
#include "llvm/Option/Option.h"
|
||||||
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -328,13 +329,15 @@ const char *ArgList::GetOrMakeJoinedArgString(unsigned Index,
|
|||||||
return MakeArgString(LHS + RHS);
|
return MakeArgString(LHS + RHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVM_DUMP_METHOD void ArgList::dump() const {
|
void ArgList::print(raw_ostream &O) const {
|
||||||
for (Arg *A : *this) {
|
for (Arg *A : *this) {
|
||||||
llvm::errs() << "* ";
|
O << "* ";
|
||||||
A->dump();
|
A->print(O);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLVM_DUMP_METHOD void ArgList::dump() const { print(dbgs()); }
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
void InputArgList::releaseMemory() {
|
void InputArgList::releaseMemory() {
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "llvm/ADT/Twine.h"
|
#include "llvm/ADT/Twine.h"
|
||||||
#include "llvm/Option/Arg.h"
|
#include "llvm/Option/Arg.h"
|
||||||
#include "llvm/Option/ArgList.h"
|
#include "llvm/Option/ArgList.h"
|
||||||
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -35,10 +36,10 @@ Option::Option(const OptTable::Info *info, const OptTable *owner)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Option::dump() const {
|
void Option::print(raw_ostream &O) const {
|
||||||
llvm::errs() << "<";
|
O << "<";
|
||||||
switch (getKind()) {
|
switch (getKind()) {
|
||||||
#define P(N) case N: llvm::errs() << #N; break
|
#define P(N) case N: O << #N; break
|
||||||
P(GroupClass);
|
P(GroupClass);
|
||||||
P(InputClass);
|
P(InputClass);
|
||||||
P(UnknownClass);
|
P(UnknownClass);
|
||||||
@ -54,33 +55,35 @@ void Option::dump() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Info->Prefixes) {
|
if (Info->Prefixes) {
|
||||||
llvm::errs() << " Prefixes:[";
|
O << " Prefixes:[";
|
||||||
for (const char * const *Pre = Info->Prefixes; *Pre != nullptr; ++Pre) {
|
for (const char *const *Pre = Info->Prefixes; *Pre != nullptr; ++Pre) {
|
||||||
llvm::errs() << '"' << *Pre << (*(Pre + 1) == nullptr ? "\"" : "\", ");
|
O << '"' << *Pre << (*(Pre + 1) == nullptr ? "\"" : "\", ");
|
||||||
}
|
}
|
||||||
llvm::errs() << ']';
|
O << ']';
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::errs() << " Name:\"" << getName() << '"';
|
O << " Name:\"" << getName() << '"';
|
||||||
|
|
||||||
const Option Group = getGroup();
|
const Option Group = getGroup();
|
||||||
if (Group.isValid()) {
|
if (Group.isValid()) {
|
||||||
llvm::errs() << " Group:";
|
O << " Group:";
|
||||||
Group.dump();
|
Group.print(O);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Option Alias = getAlias();
|
const Option Alias = getAlias();
|
||||||
if (Alias.isValid()) {
|
if (Alias.isValid()) {
|
||||||
llvm::errs() << " Alias:";
|
O << " Alias:";
|
||||||
Alias.dump();
|
Alias.print(O);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getKind() == MultiArgClass)
|
if (getKind() == MultiArgClass)
|
||||||
llvm::errs() << " NumArgs:" << getNumArgs();
|
O << " NumArgs:" << getNumArgs();
|
||||||
|
|
||||||
llvm::errs() << ">\n";
|
O << ">\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Option::dump() const { print(dbgs()); }
|
||||||
|
|
||||||
bool Option::matches(OptSpecifier Opt) const {
|
bool Option::matches(OptSpecifier Opt) const {
|
||||||
// Aliases are never considered in matching, look through them.
|
// Aliases are never considered in matching, look through them.
|
||||||
const Option Alias = getAlias();
|
const Option Alias = getAlias();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user