[clang] [CIR] Handle static methods defensively in emitCXXMemberCallExpr (PR #237420)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 6 16:46:04 PST 2026


================
@@ -2842,9 +2842,14 @@ RValue CIRGenFunction::emitCXXMemberCallExpr(const CXXMemberCallExpr *ce,
   const auto *me = cast<MemberExpr>(callee);
   const auto *md = cast<CXXMethodDecl>(me->getMemberDecl());
 
+  // Although Sema normally represents static method calls as ordinary
+  // CallExpr nodes, retain defensive handling here for parity with classic
+  // Clang (CGExprCXX.cpp:200) in case a CXXMemberCallExpr node is encountered.
   if (md->isStatic()) {
-    cgm.errorNYI(ce->getSourceRange(), "emitCXXMemberCallExpr: static method");
-    return RValue::get(nullptr);
+    emitIgnoredExpr(me->getBase());
----------------
andykaylor wrote:

It's not clear to me what this is doing. This doesn't match the classic codegen implementation referenced above.

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


More information about the cfe-commits mailing list