[clang] [CIR] Upstream support for calling functions via member expressions (PR #164518)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 22 09:56:34 PDT 2025
================
@@ -1820,10 +1820,10 @@ CIRGenCallee CIRGenFunction::emitCallee(const clang::Expr *e) {
// Resolve direct calls.
const auto *funcDecl = cast<FunctionDecl>(declRef->getDecl());
return emitDirectCallee(funcDecl);
- } else if (isa<MemberExpr>(e)) {
- cgm.errorNYI(e->getSourceRange(),
- "emitCallee: call to member function is NYI");
- return {};
+ } else if (auto me = dyn_cast<MemberExpr>(e)) {
+ const auto *fd = cast<FunctionDecl>(me->getMemberDecl());
----------------
andykaylor wrote:
I noticed that, and the incubator does the same thing, but if the dyn_cast returns null, both just fall through to the indirect reference handling, and I couldn't find a case where that actually happens so I wasn't confident that it was the right thing to do. We made the same change (`if (dyn_cast...)` -> `cast`) just above this in the DeclRefExpr handling.
https://github.com/llvm/llvm-project/pull/164518
More information about the cfe-commits
mailing list