Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ exclude = ["examples/s2", "examples/steam-mini", "examples/subclass", "examples/
#[patch.crates-io]
#cxx = { path="../cxx" }
#cxx-gen = { path="../cxx/gen/lib" }
#autocxx-bindgen = { path="../bindgen" }
#autocxx-bindgen = { path="../bindgen/bindgen" }
#moveit = { path="../moveit" }
4 changes: 2 additions & 2 deletions engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ log = "0.4"
proc-macro2 = "1.0.11"
quote = "1.0"
indoc = "1.0"
autocxx-bindgen = { version = "=0.71.1", default-features = false, features = ["logging", "which-rustfmt"] }
#autocxx-bindgen = { git = "https://github.com/adetaylor/rust-bindgen", branch = "merge-latest-upstream", default-features = false, features = ["logging", "which-rustfmt"] }
autocxx-bindgen = { version = "=0.72.0", default-features = false, features = ["logging", "which-rustfmt"] }
#autocxx-bindgen = { git = "https://github.com/adetaylor/rust-bindgen", branch = "switch-from-attributes-to-callbacks", default-features = false, features = ["logging", "which-rustfmt"] }
itertools = "0.10.3"
cc = { version = "1.0", optional = true }
# Note: Keep the patch-level version of cxx-gen and cxx in sync.
Expand Down
11 changes: 3 additions & 8 deletions engine/src/conversion/analysis/allocators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ use syn::{parse_quote, punctuated::Punctuated, token::Comma, FnArg, ReturnType};

use crate::{
conversion::{
api::{
Api, ApiName, CppVisibility, DeletedOrDefaulted, FuncToConvert, Provenance, References,
TraitSynthesis,
},
api::{Api, ApiName, CppVisibility, FuncToConvert, Provenance, TraitSynthesis},
apivec::ApiVec,
},
minisyn::minisynize_punctuated,
Expand Down Expand Up @@ -80,17 +77,15 @@ fn create_alloc_and_free(ty_name: QualifiedName) -> impl Iterator<Item = Api<Pod
inputs: minisynize_punctuated(inputs),
output: output.into(),
vis: parse_quote! { pub },
virtualness: crate::conversion::api::Virtualness::None,
virtualness: None,
cpp_vis: CppVisibility::Public,
special_member: None,
unused_template_param: false,
references: References::default(),
original_name: None,
self_ty: None,
synthesized_this_type: None,
synthetic_cpp: Some((cpp_function_body, CppFunctionKind::Function)),
add_to_trait: Some(synthesis),
is_deleted: DeletedOrDefaulted::Neither,
is_deleted: None,
provenance: Provenance::SynthesizedOther,
variadic: false,
}),
Expand Down
13 changes: 4 additions & 9 deletions engine/src/conversion/analysis/casts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ use syn::parse_quote;

use crate::{
conversion::{
api::{
Api, ApiName, CastMutability, DeletedOrDefaulted, Provenance, References,
TraitSynthesis,
},
api::{Api, ApiName, CastMutability, Provenance, TraitSynthesis},
apivec::ApiVec,
},
types::{make_ident, QualifiedName},
Expand Down Expand Up @@ -100,14 +97,12 @@ fn create_cast(from: &QualifiedName, to: &QualifiedName, mutable: CastMutability
doc_attrs: Vec::new(),
inputs: [fnarg].into_iter().collect(),
output: parse_quote! {
-> * #return_mutability #to_typ
-> __bindgen_marker_Reference < * #return_mutability #to_typ >
},
vis: parse_quote! { pub },
virtualness: crate::conversion::api::Virtualness::None,
virtualness: None,
cpp_vis: crate::conversion::api::CppVisibility::Public,
special_member: None,
unused_template_param: false,
references: References::new_with_this_and_return_as_reference(),
original_name: None,
self_ty: Some(from.clone()),
synthesized_this_type: None,
Expand All @@ -116,7 +111,7 @@ fn create_cast(from: &QualifiedName, to: &QualifiedName, mutable: CastMutability
mutable,
}),
synthetic_cpp: Some((CppFunctionBody::Cast, CppFunctionKind::Function)),
is_deleted: DeletedOrDefaulted::Neither,
is_deleted: None,
provenance: Provenance::SynthesizedOther,
variadic: false,
}),
Expand Down
20 changes: 15 additions & 5 deletions engine/src/conversion/analysis/fun/implicit_constructors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use autocxx_bindgen::callbacks::{Explicitness, SpecialMemberKind, Visibility as CppVisibility};
use indexmap::map::IndexMap as HashMap;
use indexmap::{map::Entry, set::IndexSet as HashSet};

use syn::{Type, TypeArray};
use syn::{PatType, Type, TypeArray};

use crate::conversion::api::DeletedOrDefaulted;
use crate::conversion::type_helpers::type_is_reference;
use crate::{
conversion::{
analysis::{
depth_first::fields_and_bases_first, pod::PodAnalysis, type_converter::TypeKind,
},
api::{Api, ApiName, CppVisibility, FuncToConvert, SpecialMemberKind},
api::{Api, ApiName, FuncToConvert},
apivec::ApiVec,
convert_error::ConvertErrorWithContext,
ConvertErrorFromCpp,
Expand Down Expand Up @@ -575,7 +576,7 @@ fn find_explicit_items(
.entry(ExplicitType { ty, kind })
{
Entry::Vacant(entry) => {
entry.insert(if matches!(fun.is_deleted, DeletedOrDefaulted::Deleted) {
entry.insert(if matches!(fun.is_deleted, Some(Explicitness::Deleted)) {
ExplicitFound::Deleted
} else {
ExplicitFound::UserDefined(fun.cpp_vis)
Expand Down Expand Up @@ -605,7 +606,7 @@ fn find_explicit_items(
Some(SpecialMemberKind::AssignmentOperator)
) =>
{
let is_move_assignment_operator = !fun.references.rvalue_ref_params.is_empty();
let is_move_assignment_operator = !any_input_is_rvalue_reference(&fun.inputs);
merge_fun(
impl_for.clone(),
if is_move_assignment_operator {
Expand Down Expand Up @@ -694,6 +695,15 @@ fn find_explicit_items(
(result, unknown_types)
}

fn any_input_is_rvalue_reference(
inputs: &syn::punctuated::Punctuated<crate::minisyn::FnArg, syn::token::Comma>,
) -> bool {
inputs.iter().any(|input| match &input.0 {
syn::FnArg::Receiver(_) => false,
syn::FnArg::Typed(PatType { ty, .. }, ..) => type_is_reference(ty.as_ref(), true),
})
}

/// Returns the information for a given known type.
fn known_type_items_found(constructor_details: KnownTypeConstructorDetails) -> ItemsFound {
let exists_public = SpecialMemberFound::Explicit(CppVisibility::Public);
Expand Down
Loading
Loading