[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 11:10:02 PST 2024


rjmccall wrote:

I haven't looked at your patch yet, and I'm not familiar with the `diagnose_if` feature; I'm just commenting about the AST design question because I was tagged in to do so. If `diagnose_if` is about compile-time evaluation — essentially assertion failures during constant evaluation of function calls? — there's no reason it shouldn't eventually apply to blocks, but it generally cannot apply to Objective-C methods because of the semantics of Objective-C message dispatch.

If making blocks `NamedDecl`s would actually help, we could just do that. C++ constructors aren't really named, either; they inherit from `NamedDecl` purely because it'd be really annoying for them to not inherit from `CXXMethodDecl` just to dodge having to store a meaningless name.

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


More information about the cfe-commits mailing list