Skip to content

Commit 86b4f16

Browse files
committed
Swift: remove Binding<> class
That class was meant to allow aggregate initialization of generated C++ entries having the label `id` as first argument. As aggregate initialization turned out to be undesirable (names of fields are not explicit, and `{}` must be inserted for empty superclasses), this commit removes it and disallows aggregate initialization altogether by defining empty constructors for generated classes.
1 parent 9231013 commit 86b4f16

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

swift/codegen/templates/cpp_classes.mustache

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
namespace {{namespace}} {
1414
{{#classes}}
1515

16-
struct {{name}}{{#final}} : Binding<{{name}}Tag>{{#bases}}, {{ref.name}}{{/bases}}{{/final}}{{^final}}{{#has_bases}}: {{#bases}}{{^first}}, {{/first}}{{ref.name}}{{/bases}}{{/has_bases}}{{/final}} {
16+
struct {{name}}{{#has_bases}} : {{#bases}}{{^first}}, {{/first}}{{ref.name}}{{/bases}}{{/has_bases}} {
17+
{{name}}() {}
18+
19+
{{#final}}
20+
{{trap_affix}}Label<{{name}}Tag> id{};
21+
{{/final}}
1722
{{#fields}}
1823
{{type}} {{field_name}}{};
1924
{{/fields}}

swift/extractor/trap/TrapLabel.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ inline auto trapQuoted(const std::string& s) {
5858
return std::quoted(s, '"', '"');
5959
}
6060

61-
template <typename Tag>
62-
struct Binding {
63-
TrapLabel<Tag> id;
64-
};
65-
6661
} // namespace codeql
6762

6863
namespace std {

0 commit comments

Comments
 (0)