Commit ffba96a
committed
[clang] Warn [[clang::lifetimebound]] misusages on types
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]],
it doesn't currently, so the commit at least makes the situation better
by highlighting this as a warning instead of a silent ignore.1 parent e477989 commit ffba96a
File tree
2 files changed
+14
-2
lines changed- clang
- lib/Sema
- test/SemaCXX
2 files changed
+14
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8612 | 8612 | | |
8613 | 8613 | | |
8614 | 8614 | | |
| 8615 | + | |
8615 | 8616 | | |
| 8617 | + | |
| 8618 | + | |
8616 | 8619 | | |
8617 | 8620 | | |
8618 | 8621 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
17 | 26 | | |
18 | 27 | | |
19 | 28 | | |
| |||
0 commit comments