diff options
author | Elichai Turkel <elichai.turkel@gmail.com> | 2019-05-20 15:56:03 +0300 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-05-22 13:45:59 +0200 |
commit | 24091a8b7cf0533c2aafdbf8f09a02e8046677b7 (patch) | |
tree | 6437c46af5adb034a408509d6080072bb93e3f53 | |
parent | c0e1f0b7ed8dfc21f0e931480881179b2079cb54 (diff) |
Added array pointers to the CLI
-rw-r--r-- | src/codegen/mod.rs | 2 | ||||
-rw-r--r-- | src/lib.rs | 4 | ||||
-rw-r--r-- | src/options.rs | 7 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 13c5dfc1..c3b86983 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -3909,7 +3909,7 @@ mod utils { let arg_ty = match *arg_ty.canonical_type(ctx).kind() { TypeKind::Array(t, _) => { let stream = if ctx.options().array_pointers_in_arguments { - (*arg_ty).to_rust_ty_or_opaque(ctx, &arg_item) + arg_ty.to_rust_ty_or_opaque(ctx, &arg_item) } else { t.to_rust_ty_or_opaque(ctx, &()) }; @@ -444,6 +444,10 @@ impl Builder { output_vector.push("--no-prepend-enum-name".into()); } + if self.options.array_pointers_in_arguments { + output_vector.push("--use-array-pointers-in-arguments".into()); + } + self.options .opaque_types .get_items() diff --git a/src/options.rs b/src/options.rs index ed0936a6..300036e0 100644 --- a/src/options.rs +++ b/src/options.rs @@ -326,6 +326,9 @@ where .long("enable-function-attribute-detection") .help("Enables detecting unexposed attributes in functions (slow). Used to generate #[must_use] annotations."), + Arg::with_name("use-array-pointers-in-arguments") + .long("use-array-pointers-in-arguments") + .help("Use `*const [T; size]` instead of `*const T` for C arrays"), ]) // .args() .get_matches_from(args); @@ -458,6 +461,10 @@ where builder = builder.time_phases(true); } + if matches.is_present("use-array-pointers-in-arguments") { + builder = builder.array_pointers_in_arguments(true); + } + if let Some(prefix) = matches.value_of("ctypes-prefix") { builder = builder.ctypes_prefix(prefix); } |