[llvm] 1d1cf9b - ItaniumDemangler: Update BinaryExpr::match to match the ctor

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 14:51:43 PDT 2022


Author: David Blaikie
Date: 2022-03-28T21:51:27Z
New Revision: 1d1cf9b6c42c820f38eb776cb7504564441a23ee

URL: https://github.com/llvm/llvm-project/commit/1d1cf9b6c42c820f38eb776cb7504564441a23ee
DIFF: https://github.com/llvm/llvm-project/commit/1d1cf9b6c42c820f38eb776cb7504564441a23ee.diff

LOG: ItaniumDemangler: Update BinaryExpr::match to match the ctor

Not sure if this could use more testing, but hopefully this is adequate.

Added: 
    

Modified: 
    llvm/include/llvm/Demangle/ItaniumDemangle.h
    llvm/lib/Demangle/ItaniumDemangle.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h
index 42490c2ca20e8..037e94818d287 100644
--- a/llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -1782,7 +1782,9 @@ class BinaryExpr : public Node {
       : Node(KBinaryExpr, Prec_), LHS(LHS_), InfixOperator(InfixOperator_),
         RHS(RHS_) {}
 
-  template<typename Fn> void match(Fn F) const { F(LHS, InfixOperator, RHS); }
+  template <typename Fn> 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 5d2fb2b18ab8d..42d4d39a47173 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");


        


More information about the llvm-commits mailing list