Skip to content

Commit f0f1bca

Browse files
committed
[demangler] Add getters for Qual/Vector/Pointer types
These are useful for downstream tool aligning the mangling of data types which differ between different languages/targets. Patch by Steffen Larsen <[email protected]> Differential Revision: https://reviews.llvm.org/D130909
1 parent fdc9509 commit f0f1bca

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

llvm/include/llvm/Demangle/ItaniumDemangle.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ class VendorExtQualType final : public Node {
369369
VendorExtQualType(const Node *Ty_, StringView Ext_, const Node *TA_)
370370
: Node(KVendorExtQualType), Ty(Ty_), Ext(Ext_), TA(TA_) {}
371371

372+
const Node *getTy() const { return Ty; }
373+
StringView getExt() const { return Ext; }
374+
const Node *getTA() const { return TA; }
375+
372376
template <typename Fn> void match(Fn F) const { F(Ty, Ext, TA); }
373377

374378
void printLeft(OutputBuffer &OB) const override {
@@ -417,6 +421,9 @@ class QualType final : public Node {
417421
Child_->ArrayCache, Child_->FunctionCache),
418422
Quals(Quals_), Child(Child_) {}
419423

424+
Qualifiers getQuals() const { return Quals; }
425+
const Node *getChild() const { return Child; }
426+
420427
template<typename Fn> void match(Fn F) const { F(Child, Quals); }
421428

422429
bool hasRHSComponentSlow(OutputBuffer &OB) const override {
@@ -585,6 +592,8 @@ class PointerType final : public Node {
585592
: Node(KPointerType, Pointee_->RHSComponentCache),
586593
Pointee(Pointee_) {}
587594

595+
const Node *getPointee() const { return Pointee; }
596+
588597
template<typename Fn> void match(Fn F) const { F(Pointee); }
589598

590599
bool hasRHSComponentSlow(OutputBuffer &OB) const override {
@@ -1070,6 +1079,9 @@ class VectorType final : public Node {
10701079
VectorType(const Node *BaseType_, const Node *Dimension_)
10711080
: Node(KVectorType), BaseType(BaseType_), Dimension(Dimension_) {}
10721081

1082+
const Node *getBaseType() const { return BaseType; }
1083+
const Node *getDimension() const { return Dimension; }
1084+
10731085
template<typename Fn> void match(Fn F) const { F(BaseType, Dimension); }
10741086

10751087
void printLeft(OutputBuffer &OB) const override {

0 commit comments

Comments
 (0)