================
@@ -5536,10 +5538,24 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType, 
const CGCallee &OrigCallee
         break;
       }
     }
+
+    if (const auto *MD =
+            dyn_cast_if_present<CXXMethodDecl>(OCE->getCalleeDecl());
+        MD && MD->isStatic())
+      StaticOperator = true;
   }
 
-  EmitCallArgs(Args, dyn_cast<FunctionProtoType>(FnType), E->arguments(),
-               E->getDirectCallee(), /*ParamsToSkip*/ 0, Order);
+  if (StaticOperator) {
+    // If we're calling a static operator, we need to emit the object argument
+    // and ignore it.
+    EmitIgnoredExpr(E->getArg(0));
+
+    EmitCallArgs(Args, dyn_cast<FunctionProtoType>(FnType),
+                 drop_begin(E->arguments(), 1), E->getDirectCallee(),
+                 /*ParamsToSkip*/ 0, Order);
+  } else
+    EmitCallArgs(Args, dyn_cast<FunctionProtoType>(FnType), E->arguments(),
+                 E->getDirectCallee(), /*ParamsToSkip*/ 0, Order);
----------------
shafik wrote:

nit
```suggestion
                 E->getDirectCallee(), /*ParamsToSkip=*/0, Order);
```

https://github.com/llvm/llvm-project/pull/68485
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to