diff --git a/Cargo.lock b/Cargo.lock index 760e57bd4..9ee725e65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -165,8 +165,6 @@ dependencies = [ [[package]] name = "autocxx-bindgen" version = "0.65.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c9fb7b8dd83a582e12157367773d8d1195f2dea54d4250aaf3426abae3237aa" dependencies = [ "bitflags", "cexpr", diff --git a/Cargo.toml b/Cargo.toml index b256777cc..3b59a0064 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,8 +34,8 @@ moveit = { version = "0.6", features = [ "cxx" ] } members = ["parser", "engine", "gen/cmd", "gen/build", "macro", "demo", "tools/reduce", "tools/mdbook-preprocessor", "integration-tests"] exclude = ["examples/s2", "examples/steam-mini", "examples/subclass", "examples/chromium-fake-render-frame-host", "examples/pod", "examples/non-trivial-type-on-stack", "examples/llvm", "examples/reference-wrappers", "examples/cpp_calling_rust", "tools/stress-test"] -#[patch.crates-io] +[patch.crates-io] #cxx = { path="../cxx" } #cxx-gen = { path="../cxx/gen/lib" } -#autocxx-bindgen = { path="../bindgen" } +autocxx-bindgen = { path="../bindgen/bindgen" } #moveit = { path="../moveit" } diff --git a/engine/src/conversion/analysis/tdef.rs b/engine/src/conversion/analysis/tdef.rs index 1c414e8c4..60b29cd09 100644 --- a/engine/src/conversion/analysis/tdef.rs +++ b/engine/src/conversion/analysis/tdef.rs @@ -120,6 +120,7 @@ fn get_replacement_typedef( name, item: TypedefKind::Type(ity.into()), old_tyname, + is_reference, analysis: TypedefAnalysis { kind: TypedefKind::Type(converted_type.into()), deps: final_type.types_encountered, diff --git a/engine/src/conversion/api.rs b/engine/src/conversion/api.rs index d5da41c52..6de1de02a 100644 --- a/engine/src/conversion/api.rs +++ b/engine/src/conversion/api.rs @@ -511,6 +511,7 @@ pub(crate) enum Api { name: ApiName, item: TypedefKind, old_tyname: Option, + is_reference: bool, analysis: T::TypedefAnalysis, }, /// An enum encountered in the @@ -666,6 +667,7 @@ impl Api { name: ApiName, item: TypedefKind, old_tyname: Option, + is_reference: bool, analysis: T::TypedefAnalysis, ) -> Result>>, ConvertErrorWithContext> where @@ -675,6 +677,7 @@ impl Api { name, item, old_tyname, + is_reference, analysis, }))) } diff --git a/engine/src/conversion/error_reporter.rs b/engine/src/conversion/error_reporter.rs index adea153cf..b55c97298 100644 --- a/engine/src/conversion/error_reporter.rs +++ b/engine/src/conversion/error_reporter.rs @@ -83,6 +83,7 @@ pub(crate) fn convert_apis( ApiName, TypedefKind, Option, + bool, A::TypedefAnalysis, ) -> Result>>, ConvertErrorWithContext>, { @@ -172,8 +173,9 @@ pub(crate) fn convert_apis( name, item, old_tyname, + is_reference, analysis, - } => typedef_conversion(name, item, old_tyname, analysis), + } => typedef_conversion(name, item, old_tyname, is_reference, analysis), Api::Function { name, fun, diff --git a/engine/src/conversion/parse/parse_bindgen.rs b/engine/src/conversion/parse/parse_bindgen.rs index f49914540..04866899c 100644 --- a/engine/src/conversion/parse/parse_bindgen.rs +++ b/engine/src/conversion/parse/parse_bindgen.rs @@ -333,6 +333,7 @@ impl<'a> ParseBindgen<'a> { }, Box::new(Type::Path(old_path).into()), ), + is_reference: false, old_tyname: Some(old_tyname), analysis: (), }); @@ -373,12 +374,14 @@ impl<'a> ParseBindgen<'a> { } Item::Type(ity) => { let annotations = BindgenSemanticAttributes::new(&ity.attrs); + let is_reference = annotations.has_attr("reference"); // It's known that sometimes bindgen will give us duplicate typedefs with the // same name - see test_issue_264. self.apis.push(UnanalyzedApi::Typedef { name: api_name(ns, ity.ident.clone(), &annotations), item: TypedefKind::Type(ity.into()), old_tyname: None, + is_reference, analysis: (), }); Ok(())