1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

[MS Demangler] Add a helper function to print a Node as a string.

llvm-svn: 349359
This commit is contained in:
Zachary Turner 2018-12-17 16:14:50 +00:00
parent 96837a54be
commit 9c59ff4bb6
2 changed files with 10 additions and 0 deletions

View File

@ -235,6 +235,8 @@ struct Node {
virtual void output(OutputStream &OS, OutputFlags Flags) const = 0;
std::string toString() const;
private:
NodeKind Kind;
};

View File

@ -113,6 +113,14 @@ static void outputCallingConvention(OutputStream &OS, CallingConv CC) {
}
}
std::string Node::toString() const {
OutputStream OS;
initializeOutputStream(nullptr, nullptr, OS, 1024);
this->output(OS, llvm::ms_demangle::OF_Default);
OS << '\0';
return {OS.getBuffer()};
}
void TypeNode::outputQuals(bool SpaceBefore, bool SpaceAfter) const {}
void PrimitiveTypeNode::outputPre(OutputStream &OS, OutputFlags Flags) const {