diff options
-rw-r--r-- | llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h | 2 | ||||
-rw-r--r-- | llvm/lib/Demangle/MicrosoftDemangleNodes.cpp | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h b/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h index 1d0b66a7bf4..1eca6762475 100644 --- a/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h +++ b/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h @@ -235,6 +235,8 @@ struct Node { virtual void output(OutputStream &OS, OutputFlags Flags) const = 0; + std::string toString() const; + private: NodeKind Kind; }; diff --git a/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp b/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp index c57f0cfaaa5..930c838753a 100644 --- a/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp +++ b/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp @@ -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 { |