aaronpuchert wrote:

> > That might not be enough. A function might not be used (or even referenced) 
> > in the TU that defines it, but only in other TUs. But it would certainly 
> > catch a number of issues already.
> 
> Right, though catching that ends up being pretty impossible. The most you 
> could do is determine that the declaration in the defining TU doesn't have 
> it, but not that other forward declarations not visible could catch it.

Correct, these are all just heuristics. Functions are not typically 
"forward-declared", so they often have a canonical public declaration. But it 
is of course possible to declare functions in multiple header files.

> Unfortunately, unless an attribute contributes to mangling (which, should we 
> consider that?) there is no real way to catch every case.

No, I think we don't want mangling. One of the design goals of Thread Safety 
Analysis was that the attributes should be "erasable", so that they can be 
dropped for compilers that don't understand them. (See for example 
https://static.googleusercontent.com/media/research.google.com/en/us/pubs/archive/42958.pdf.)

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

Reply via email to