[clang] [CIR] Add support for indirect calls (PR #139748)

Sirui Mu via cfe-commits cfe-commits at lists.llvm.org
Sat May 17 08:34:08 PDT 2025


================
@@ -937,8 +937,28 @@ CIRGenCallee CIRGenFunction::emitCallee(const clang::Expr *e) {
       return emitDirectCallee(cgm, funcDecl);
   }
 
-  cgm.errorNYI(e->getSourceRange(), "Unsupported callee kind");
-  return {};
+  assert(!cir::MissingFeatures::opCallPseudoDtor());
----------------
Lancern wrote:

> Please add a check for dyn_cast<MemberExpr>(e) and add an errorNYI for that case.

Done.

> Also, the two inner if statements above fall through to here, but I'm not convinced we have an indirect call in those cases. Maybe add NYI handlers there too?

I updated the two `if` statements above as follows:

- I added to the first `if` with a guarding `assert` that ensures when it falls off we have an indirect call through a function pointer lvalue.
- I changed the second `if` to not falling by replacing the `dyn_cast` with a `cast`. The latest code in the incubator actually does this.

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


More information about the cfe-commits mailing list