[libcxx-commits] [libcxxabi] [llvm] [libc++abi] Enable demangling of `cp` expression production (PR #114882)

Hubert Tong via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 4 18:24:27 PST 2024


================
@@ -2077,17 +2077,25 @@ class SizeofParamPackExpr : public Node {
 class CallExpr : public Node {
   const Node *Callee;
   NodeArray Args;
+  bool IsParen; // (func)(args ...) ?
 
 public:
-  CallExpr(const Node *Callee_, NodeArray Args_, Prec Prec_)
-      : Node(KCallExpr, Prec_), Callee(Callee_), Args(Args_) {}
+  CallExpr(const Node *Callee_, NodeArray Args_, bool IsParen_, Prec Prec_)
+      : Node(KCallExpr, Prec_), Callee(Callee_), Args(Args_),
+        IsParen(IsParen_) {}
 
   template <typename Fn> void match(Fn F) const {
-    F(Callee, Args, getPrecedence());
+    F(Callee, Args, IsParen, getPrecedence());
   }
 
   void printLeft(OutputBuffer &OB) const override {
-    Callee->print(OB);
+    if (IsParen) {
+      OB.printOpen();
+      Callee->print(OB);
+      OB.printClose();
+    } else {
+      Callee->print(OB);
+    }
----------------
hubert-reinterpretcast wrote:

```suggestion
    if (IsParen)
      OB.printOpen();
    Callee->print(OB);
    if (IsParen)
      OB.printClose();
```

https://github.com/llvm/llvm-project/pull/114882


More information about the libcxx-commits mailing list