Skip to content
Closed
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
5 changes: 3 additions & 2 deletions c2rust-transpile/src/translator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4997,10 +4997,11 @@ impl<'c> Translation<'c> {
self.import_type(type_id, file_id);
}

// Caching skips critical side effect of `import_type` call.
// Look up the decl in the cache and return what we find (if we find anything)
if let Some(init) = self.zero_inits.borrow().get(&decl_id) {
/*if let Some(init) = self.zero_inits.borrow().get(&decl_id) {
return Ok(init.clone());
}
}*/

let name_decl_id = match self.ast_context.index(type_id).kind {
CTypeKind::Typedef(decl_id) => decl_id,
Expand Down
16 changes: 12 additions & 4 deletions c2rust/src/bin/c2rust-transpile.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use clap::{Parser, ValueEnum};
use clap::{ArgAction, Parser, ValueEnum};
use log::LevelFilter;
use regex::Regex;
use std::{ffi::OsStr, fs, path::PathBuf};
Expand Down Expand Up @@ -124,9 +124,17 @@ struct Args {
#[clap(long)]
reduce_type_annotations: bool,

/// Output file in such a way that the refactoring tool can deduplicate code
#[clap(short = 'r', long)]
reorganize_definitions: bool,
/// Disable `--reorganize-definitions`
#[clap(long = "no-reorganize-definitions", action = ArgAction::SetFalse)]
reorganize_definitions: bool, // NB, this *is* the right field; this flag sets it to *false*.

/// Output file in such a way that the refactoring tool can deduplicate code (enabled by default; disable with `--no-reorganize-definitions`)
#[clap(
short = 'r',
long = "reorganize-definitions",
conflicts_with = "reorganize-definitions"
)]
_unused_reorganize_definitions: bool, // Field is unused, but flag mutually excludes the negative sense above.

/// Extra arguments to pass to clang frontend during parsing the input C file
#[clap(multiple = true, last(true))]
Expand Down
Loading