[all-commits] [llvm/llvm-project] 4f69f4: (reland) [clang] Warn [[clang::lifetimebound]] mis...
Maksim Ivanov via All-commits
all-commits at lists.llvm.org
Fri Jan 10 03:32:40 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4f69f4579132900949a7886fe3ba92d693430da0
https://github.com/llvm/llvm-project/commit/4f69f4579132900949a7886fe3ba92d693430da0
Author: Maksim Ivanov <emaxx at google.com>
Date: 2025-01-10 (Fri, 10 Jan 2025)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/lib/Sema/SemaType.cpp
M clang/test/SemaCXX/attr-lifetimebound.cpp
Log Message:
-----------
(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.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list