diff options
author | Maksim Ivanov <emaxx@google.com> | 2025-01-10 12:32:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-10 12:32:19 +0100 |
commit | 4f69f4579132900949a7886fe3ba92d693430da0 (patch) | |
tree | 375e518715ce37d5c9fa1dffe863c8f2e2037ea5 /llvm/lib/CodeGen/MachineVerifier.cpp | |
parent | e9e7b2adcf28c702f4ad37bad34ac437ee680799 (diff) | |
download | llvm-4f69f4579132900949a7886fe3ba92d693430da0.zip llvm-4f69f4579132900949a7886fe3ba92d693430da0.tar.gz llvm-4f69f4579132900949a7886fe3ba92d693430da0.tar.bz2 |
(reland) [clang] Warn [[clang::lifetimebound]] misusages on types (#118501)
This relands #118281 as-is, after it got reverted in commit
356df2dd72e8299b5de58e9390283110c19f7c76. The reland can go in after we
fixed some downstream codebases that had incorrectly placed attributes.
Original commit description:
> Emit the "cannot be applied to types" warning instead of silently
ignoring the attribute when it's attempted to be used on a type (instead
of a function argument or the function definition).
>
> Before this commit, the warning has been printed when the attribute
was (mis)used on a decl-specifier, but not in other places in a
declarator.
>
> Examples where the warning starts being emitted with this commit:
>
> ```
> int * [[clang::lifetimebound]] x;
>
> void f(int * [[clang::lifetimebound]] x);
>
> void g(int * [[clang::lifetimebound]]);
> ```
>
> Note that the last example is the case of an unnamed function
parameter. While in theory Clang could've supported the
`[[clang::lifetimebound]]` analysis for unnamed parameters, it doesn't
currently, so the commit at least makes the situation better by
highlighting this as a warning instead of a silent ignore - which was
reported at #96034.
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
0 files changed, 0 insertions, 0 deletions