apple-fcloutier wrote:

I think there's limited value to diagnose_if on blocks, since that will apply 
to a variable of block type and not to the block type. In other words, given 
this:

```c
void (^block)(int *) = ^(int *p) __attribute__((diagnose_if(p == 0, "p is 
NULL"))) { ... };
block(0);
```

even assuming the we did all of the rest of the work (including piping the 
block through diagnose_if checks, which is non-trivial because BlockDecl isn't 
a NamedDecl), there would be no diagnostic when from a block type with 
diagnose_if to a block without it, and then no diagnostic when calling block(0).

There is almost certainly value in introducing a base class beneath 
ObjCMethodDecl and FunctionDecl that is both a NamedDecl and a DeclContext, 
because I'm not the first person to run into this problem. If I do the work, 
whose review/approval do we need? Is it deep enough in the guts of clang that 
it will take an RFC or is it something that we can reasonably thumbs-up in a PR?

https://github.com/llvm/llvm-project/pull/115056
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to