From 1d1cf9b6c42c820f38eb776cb7504564441a23ee Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 28 Mar 2022 21:21:37 +0000 Subject: [PATCH] ItaniumDemangler: Update BinaryExpr::match to match the ctor Not sure if this could use more testing, but hopefully this is adequate. --- llvm/include/llvm/Demangle/ItaniumDemangle.h | 4 +++- llvm/lib/Demangle/ItaniumDemangle.cpp | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h index 42490c2ca20e..037e94818d28 100644 --- a/llvm/include/llvm/Demangle/ItaniumDemangle.h +++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h @@ -1782,7 +1782,9 @@ public: : Node(KBinaryExpr, Prec_), LHS(LHS_), InfixOperator(InfixOperator_), RHS(RHS_) {} - template void match(Fn F) const { F(LHS, InfixOperator, RHS); } + template void match(Fn F) const { + F(LHS, InfixOperator, RHS, getPrecedence()); + } void printLeft(OutputBuffer &OB) const override { bool ParenAll = OB.isGtInsideTemplateArgs() && InfixOperator == ">"; diff --git a/llvm/lib/Demangle/ItaniumDemangle.cpp b/llvm/lib/Demangle/ItaniumDemangle.cpp index 5d2fb2b18ab8..42d4d39a4717 100644 --- a/llvm/lib/Demangle/ItaniumDemangle.cpp +++ b/llvm/lib/Demangle/ItaniumDemangle.cpp @@ -172,6 +172,10 @@ struct DumpVisitor { return printStr("TemplateParamKind::Template"); } } + void print(llvm::itanium_demangle::Node::Prec) { + // Do nothing, the printing functions handle precedence with parentheses + // already. + } void newLine() { printStr("\n");