aaronpuchert wrote:

> Maybe I misunderstood the code of this PR, but I thought it only checks 
> definitions.

That's my understanding as well. I was just thinking about the usual 
requirement of putting the attribute on the first declaration (like the 
standard mandates it for `[[noreturn]]`). Users tend the think of _the_ 
declaration and the definition, but in general there can be an arbitrary number 
of declarations, at most one of which is a definition.

The idea behind the standard requirement (to my understanding) is that the 
attribute set doesn't "change" throughout the compilation unit. Of course you 
have to put any uses after the first declaration, and with that requirement you 
can analyze uses directly after parsing them without getting a different result 
from doing it at the end, with all attributes accumulated.

That being said, I'm fine with the idea. I just think this should live in Sema 
instead of Analysis. That's where we're doing semantic checks of the attributes 
themselves.

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