Commit b1d0605
authored
[Clang] adjust caret placement for the suggested attribute location for enum class (#168092)
Fixes #163224
---
This patch addresses the issue by correcting the caret insertion
location for attributes incorrectly positioned before an enum. The
location is now derived from the associated `EnumDecl`: for named enums,
the attribute is placed before the identifier, while for anonymous enum
definitions, it is placed before the opening brace, with a fallback to
the semicolon when no brace is present.
For example:
```cpp
[[nodiscard]] enum class E1 {};
```
is now suggested as:
```cpp
enum class [[nodiscard]] E1 {};
```1 parent be3204a commit b1d0605
File tree
5 files changed
+84
-26
lines changed- clang
- docs
- include/clang/AST
- lib
- Parse
- Sema
- test/FixIt
5 files changed
+84
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
| 451 | + | |
| 452 | + | |
451 | 453 | | |
452 | 454 | | |
453 | 455 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4040 | 4040 | | |
4041 | 4041 | | |
4042 | 4042 | | |
| 4043 | + | |
| 4044 | + | |
| 4045 | + | |
| 4046 | + | |
| 4047 | + | |
4043 | 4048 | | |
4044 | 4049 | | |
4045 | 4050 | | |
| |||
4077 | 4082 | | |
4078 | 4083 | | |
4079 | 4084 | | |
| 4085 | + | |
| 4086 | + | |
| 4087 | + | |
| 4088 | + | |
4080 | 4089 | | |
4081 | 4090 | | |
4082 | 4091 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1100 | 1100 | | |
1101 | 1101 | | |
1102 | 1102 | | |
1103 | | - | |
1104 | | - | |
1105 | | - | |
1106 | | - | |
1107 | | - | |
1108 | | - | |
1109 | | - | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
1115 | | - | |
1116 | | - | |
1117 | | - | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
1118 | 1113 | | |
1119 | | - | |
1120 | | - | |
1121 | | - | |
1122 | | - | |
1123 | | - | |
1124 | | - | |
1125 | | - | |
1126 | | - | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
1127 | 1122 | | |
1128 | 1123 | | |
1129 | 1124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18484 | 18484 | | |
18485 | 18485 | | |
18486 | 18486 | | |
| 18487 | + | |
| 18488 | + | |
| 18489 | + | |
| 18490 | + | |
18487 | 18491 | | |
18488 | 18492 | | |
18489 | 18493 | | |
18490 | 18494 | | |
18491 | 18495 | | |
18492 | 18496 | | |
18493 | | - | |
| 18497 | + | |
18494 | 18498 | | |
18495 | 18499 | | |
18496 | | - | |
18497 | | - | |
| 18500 | + | |
| 18501 | + | |
18498 | 18502 | | |
18499 | 18503 | | |
18500 | 18504 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
0 commit comments