Commit b509551
committed
[cxx-interop] Clone all of the attributes from base method correctly
If a C++ `struct Base` declares a method with a Clang attribute that Swift is able to import, and `struct Derived` inherits from `Base`, the method should get cloned from `Base` to `Derived` with its attributes.
Previously we were only cloning one attribute at most due to a bug in `cloneImportedAttributes`. DeclAttributes is an intrusively linked list, and it was being made invalid while iterating over it: `otherDecl->getAttrs().add(attrs)` iterates over the list and calls `otherDecl->add(eachElement)`, which invalidates the iterator after the first iteration.1 parent 71c81d5 commit b509551
File tree
3 files changed
+12
-11
lines changed- lib/ClangImporter
- test/Interop/Cxx/class/inheritance
- Inputs
3 files changed
+12
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5699 | 5699 | | |
5700 | 5700 | | |
5701 | 5701 | | |
5702 | | - | |
5703 | | - | |
5704 | | - | |
| 5702 | + | |
| 5703 | + | |
| 5704 | + | |
| 5705 | + | |
5705 | 5706 | | |
5706 | 5707 | | |
5707 | 5708 | | |
| |||
5739 | 5740 | | |
5740 | 5741 | | |
5741 | 5742 | | |
5742 | | - | |
5743 | | - | |
5744 | 5743 | | |
5745 | 5744 | | |
5746 | 5745 | | |
| |||
5770 | 5769 | | |
5771 | 5770 | | |
5772 | 5771 | | |
5773 | | - | |
5774 | | - | |
| 5772 | + | |
5775 | 5773 | | |
5776 | 5774 | | |
5777 | 5775 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | | - | |
| 69 | + | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| |||
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
99 | | - | |
| 101 | + | |
| 102 | + | |
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
| |||
0 commit comments