Skip to content

Commit

Permalink
Fix badly named alloc function - fixes #1318
Browse files Browse the repository at this point in the history
  • Loading branch information
adetaylor committed Aug 25, 2023
1 parent b9550bd commit 2ef099d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions engine/src/conversion/analysis/allocators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ fn create_alloc_and_free(ty_name: QualifiedName) -> impl Iterator<Item = Api<Pod
}

pub(crate) fn get_alloc_name(ty_name: &QualifiedName) -> QualifiedName {
get_name(ty_name, "alloc")
get_name(ty_name, "autocxx_alloc")
}

pub(crate) fn get_free_name(ty_name: &QualifiedName) -> QualifiedName {
get_name(ty_name, "free")
get_name(ty_name, "autocxx_free")
}

fn get_name(ty_name: &QualifiedName, label: &str) -> QualifiedName {
Expand Down
13 changes: 13 additions & 0 deletions integration-tests/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12241,6 +12241,19 @@ fn test_ignore_va_list() {
run_test("", hdr, rs, &["A"], &[]);
}

#[test]
fn test_badly_named_alloc() {
let hdr = indoc! {"
#include <stdarg.h>
class A {
public:
void alloc();
};
"};
let rs = quote! {};
run_test("", hdr, rs, &["A"], &[]);
}

#[test]
fn test_cpp_union_pod() {
let hdr = indoc! {"
Expand Down

0 comments on commit 2ef099d

Please sign in to comment.