[clang] [ObjC] Enable diagnose_if on Objective-C methods (PR #115056)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 22 10:59:53 PST 2024
apple-fcloutier wrote:
This is a design space that is large for a person who does not know Clang's internals and history very well, but that seems fairly narrow for someone with a lot of experience. As a matter of fact, [there is a CallableDecl](https://github.com/llvm/llvm-project/pull/115056/files#diff-255a21a02a8966766225831836d482547787baf9a770fbf67178ebb7d7347e27R521) in this change that I can only assume doesn't meet the expectations. I'm concerned that essential stakeholders will drop out of the review if I need to iterate too much, and then this won't get done.
Here's some things I think that we can do here, and I'd like you to tell me what you think is the most likely to succeed:
1. We can find that `CallableDecl` as written is sort of the way to go (in which case I would like to know what has to change in order to make it the way to go). This can be extended to support blocks.
2. I can throw away `CallableDecl` and make `CallStackFrame` subclassable instead. This can be extended to support blocks.
3. We can find that putting a base class underneath `ObjCMethodDecl` and `FunctionDecl` is the way to go; this base class would inherit from `NamedDecl` and `DeclContext` and provide parameter accessors. This cannot be extended to support blocks because they are not NamedDecls.
In all cases, this change has nothing to do with adding compile-time evaluation for blocks–it doesn't even have anything to do with adding compile-time evaluation of ObjCMethodDecl. The fact that we need to deal with ObjCMethodDecl here at all is just an artifact of `diagnose_if` invoking `EvaluateWithSubstitution` and pretending that the `diagnose_if` expression is evaluated within the context of the declaration it's attached to. As a result, even if the solution we pick is extensible to blocks, I don't expect to add support for blocks in compile-time evaluation; we would merely make it a little bit easier.
https://github.com/llvm/llvm-project/pull/115056
More information about the cfe-commits
mailing list