[PATCH] D73208: [objc_direct] fix codegen for mismatched Decl/Impl return types

Pierre Habouzit via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 22 17:59:24 PST 2020


MadCoder added a comment.

In D73208#1835051 <https://reviews.llvm.org/D73208#1835051>, @dexonsmith wrote:

> Why isn't a similar dance needed for non-direct methods?


because non direct methods do not need an `llvm::Function` to be synthesized at the call-site. direct methods do, and they form one with the type of the declaration they see. Then that same `llvm::Function` is used when you CodeGen the Implementation, so if there's a mismatch, sadness ensues because the LLVM IR verifier will notice the discrepancy between the declared return type of the function and the actual types coming out of the `ret` codepaths.

Regular obj-C methods use the _implementation_ types for the codegen (the declaration(s) aren't even consulted) and I want to stick at what obj-c does as much as I can.

(as a data point: If you use obj-C types with C functions, the type of the first declaration seen is used instead).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73208/new/

https://reviews.llvm.org/D73208





More information about the cfe-commits mailing list