[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)
Aaron Puchert via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 30 16:41:23 PDT 2024
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
More information about the cfe-commits
mailing list