Skip to content

Commit

Permalink
Partial work for reference fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adetaylor committed Jun 28, 2023
1 parent 7d3159a commit e80dc35
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
1 change: 1 addition & 0 deletions engine/src/conversion/analysis/tdef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions engine/src/conversion/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ pub(crate) enum Api<T: AnalysisPhase> {
name: ApiName,
item: TypedefKind,
old_tyname: Option<QualifiedName>,
is_reference: bool,
analysis: T::TypedefAnalysis,
},
/// An enum encountered in the
Expand Down Expand Up @@ -666,6 +667,7 @@ impl<T: AnalysisPhase> Api<T> {
name: ApiName,
item: TypedefKind,
old_tyname: Option<QualifiedName>,
is_reference: bool,
analysis: T::TypedefAnalysis,
) -> Result<Box<dyn Iterator<Item = Api<T>>>, ConvertErrorWithContext>
where
Expand All @@ -675,6 +677,7 @@ impl<T: AnalysisPhase> Api<T> {
name,
item,
old_tyname,
is_reference,
analysis,
})))
}
Expand Down
4 changes: 3 additions & 1 deletion engine/src/conversion/error_reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ pub(crate) fn convert_apis<FF, SF, EF, TF, A, B: 'static>(
ApiName,
TypedefKind,
Option<QualifiedName>,
bool,
A::TypedefAnalysis,
) -> Result<Box<dyn Iterator<Item = Api<B>>>, ConvertErrorWithContext>,
{
Expand Down Expand Up @@ -172,8 +173,9 @@ pub(crate) fn convert_apis<FF, SF, EF, TF, A, B: 'static>(
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,
Expand Down
3 changes: 3 additions & 0 deletions engine/src/conversion/parse/parse_bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ impl<'a> ParseBindgen<'a> {
},
Box::new(Type::Path(old_path).into()),
),
is_reference: false,
old_tyname: Some(old_tyname),
analysis: (),
});
Expand Down Expand Up @@ -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(())
Expand Down

0 comments on commit e80dc35

Please sign in to comment.