[llvm] r349359 - [MS Demangler] Add a helper function to print a Node as a string.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 17 08:14:51 PST 2018
Author: zturner
Date: Mon Dec 17 08:14:50 2018
New Revision: 349359
URL: http://llvm.org/viewvc/llvm-project?rev=349359&view=rev
Log:
[MS Demangler] Add a helper function to print a Node as a string.
Modified:
llvm/trunk/include/llvm/Demangle/MicrosoftDemangleNodes.h
llvm/trunk/lib/Demangle/MicrosoftDemangleNodes.cpp
Modified: llvm/trunk/include/llvm/Demangle/MicrosoftDemangleNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Demangle/MicrosoftDemangleNodes.h?rev=349359&r1=349358&r2=349359&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Demangle/MicrosoftDemangleNodes.h (original)
+++ llvm/trunk/include/llvm/Demangle/MicrosoftDemangleNodes.h Mon Dec 17 08:14:50 2018
@@ -235,6 +235,8 @@ struct Node {
virtual void output(OutputStream &OS, OutputFlags Flags) const = 0;
+ std::string toString() const;
+
private:
NodeKind Kind;
};
Modified: llvm/trunk/lib/Demangle/MicrosoftDemangleNodes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Demangle/MicrosoftDemangleNodes.cpp?rev=349359&r1=349358&r2=349359&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangleNodes.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangleNodes.cpp Mon Dec 17 08:14:50 2018
@@ -113,6 +113,14 @@ static void outputCallingConvention(Outp
}
}
+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 {
More information about the llvm-commits
mailing list