[clang] [ObjC] Enable diagnose_if on Objective-C methods (PR #115056)
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 22 10:01:43 PST 2024
rjmccall wrote:
> An abstraction that includes blocks doesn't help us here because we are looking for the combination of `NamedDecl` and `DeclContext` and `BlockDecl` isn't a `NamedDecl`.
I think you're focusing a little narrowly here. I can't imagine why you'd specifically need a `NamedDecl*`; you're not putting this in a lookup table, and names in isolation aren't really useful. You probably want to identify the function definition in a diagnostic, and for that you have to go beyond names. For example, any diagnostic that describes a lambda as a non-specific `operator()` is a bad diagnostic; we really want to always describe it something like "lambda at foo.h:2400:16". That same idea works perfect fine for blocks.
Identify the operations you want to be able to do with this common abstraction, and I'm sure most of them apply equally to blocks and can be supported there.
https://github.com/llvm/llvm-project/pull/115056
More information about the cfe-commits
mailing list