[demangler] Fix node matchers
* Add instantiation tests to ItaniumDemangleTest, to make sure all
match functions provide constructor arguments to the provided functor.
* Fix the Node constructors that lost const qualification on arguments.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D122665
GitOrigin-RevId: abffdd88767791ef6da4d2df7ec7ab158eb8b775
diff --git a/src/demangle/ItaniumDemangle.h b/src/demangle/ItaniumDemangle.h
index 4fc2181..46b390b 100644
--- a/src/demangle/ItaniumDemangle.h
+++ b/src/demangle/ItaniumDemangle.h
@@ -457,7 +457,7 @@
const StringView Postfix;
public:
- PostfixQualifiedType(Node *Ty_, StringView Postfix_)
+ PostfixQualifiedType(const Node *Ty_, StringView Postfix_)
: Node(KPostfixQualifiedType), Ty(Ty_), Postfix(Postfix_) {}
template<typename Fn> void match(Fn F) const { F(Ty, Postfix); }
@@ -1047,9 +1047,8 @@
const Node *Dimension;
public:
- VectorType(const Node *BaseType_, Node *Dimension_)
- : Node(KVectorType), BaseType(BaseType_),
- Dimension(Dimension_) {}
+ VectorType(const Node *BaseType_, const Node *Dimension_)
+ : Node(KVectorType), BaseType(BaseType_), Dimension(Dimension_) {}
template<typename Fn> void match(Fn F) const { F(BaseType, Dimension); }
@@ -1846,7 +1845,8 @@
const StringView Postfix;
public:
- EnclosingExpr(StringView Prefix_, Node *Infix_, Prec Prec_ = Prec::Primary)
+ EnclosingExpr(StringView Prefix_, const Node *Infix_,
+ Prec Prec_ = Prec::Primary)
: Node(KEnclosingExpr, Prec_), Prefix(Prefix_), Infix(Infix_) {}
template <typename Fn> void match(Fn F) const {