Skip to content

Commit a7aabe9

Browse files
committed
Merge branch 'denote-defaulted' into HEAD
2 parents 358ff50 + c86b470 commit a7aabe9

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

bindgen/codegen/helpers.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ pub trait CppSemanticAttributeCreator {
166166
self.add_ident("deleted")
167167
}
168168

169+
fn defaulted_fn(&mut self) {
170+
self.add_ident("defaulted")
171+
}
172+
169173
fn layout(&mut self, layout: &Layout) {
170174
let sz = ast_ty::int_expr(layout.size as i64);
171175
let align = ast_ty::int_expr(layout.align as i64);

bindgen/codegen/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4404,6 +4404,9 @@ impl CodeGenerator for Function {
44044404
if self.deleted_fn() {
44054405
semantic_annotations.deleted_fn();
44064406
}
4407+
if self.defaulted_fn() {
4408+
semantic_annotations.defaulted_fn();
4409+
}
44074410

44084411
let link_name = mangled_name.unwrap_or(name);
44094412
if !is_dynamic_function &&

bindgen/ir/function.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,11 @@ pub struct Function {
124124
/// C++ visibility
125125
visibility: Visibility,
126126

127-
/// Whether it's deleted (=default)
127+
/// Whether it's deleted (=delete)
128128
is_deleted: bool,
129+
130+
/// Whether it's explicitly defaulted (=default)
131+
is_defaulted: bool,
129132
}
130133

131134
impl Function {
@@ -140,6 +143,7 @@ impl Function {
140143
special_member: Option<SpecialMemberKind>,
141144
visibility: Visibility,
142145
is_deleted: bool,
146+
is_defaulted: bool,
143147
) -> Self {
144148
Function {
145149
name,
@@ -151,6 +155,7 @@ impl Function {
151155
special_member,
152156
visibility,
153157
is_deleted,
158+
is_defaulted,
154159
}
155160
}
156161

@@ -198,6 +203,11 @@ impl Function {
198203
pub fn deleted_fn(&self) -> bool {
199204
self.is_deleted
200205
}
206+
207+
/// Whether this is a function that's been deleted (=delete)
208+
pub fn defaulted_fn(&self) -> bool {
209+
self.is_defaulted
210+
}
201211
}
202212

203213
impl DotAttributes for Function {
@@ -800,6 +810,7 @@ impl ClangSubItemParser for Function {
800810
special_member,
801811
visibility,
802812
cursor.is_deleted_function(),
813+
cursor.is_defaulted_function(),
803814
);
804815
Ok(ParseResult::New(function, Some(cursor)))
805816
}

0 commit comments

Comments
 (0)