[clang] [CIR] Upstream support for C++ member function calls (PR #140290)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Mon May 19 09:44:26 PDT 2025
================
@@ -1148,6 +1146,35 @@ mlir::Value CIRGenFunction::emitAlloca(StringRef name, mlir::Type ty,
return addr;
}
+// Note: this function also emit constructor calls to support a MSVC extensions
+// allowing explicit constructor function call.
+RValue CIRGenFunction::emitCXXMemberCallExpr(const CXXMemberCallExpr *ce,
+ ReturnValueSlot returnValue) {
+ const Expr *callee = ce->getCallee()->IgnoreParens();
+
+ if (isa<BinaryOperator>(callee)) {
+ cgm.errorNYI(ce->getSourceRange(),
+ "emitCXXMemberCallExpr: C++ binary operator");
+ return RValue::get(nullptr);
+ }
+
+ const auto *me = cast<MemberExpr>(callee);
+ const auto *md = cast<CXXMethodDecl>(me->getMemberDecl());
+
+ if (md->isStatic()) {
+ cgm.errorNYI(ce->getSourceRange(), "emitCXXMemberCallExpr: static method");
+ return RValue::get(nullptr);
+ }
----------------
andykaylor wrote:
This is marked NYI in the incubator. The classic codegen only has a couple of lines of code here to handle it, but I'd prefer to leave it for a later PR so I can properly investigate why the incubator didn't implement it.
https://github.com/llvm/llvm-project/pull/140290
More information about the cfe-commits
mailing list