Skip to content

Commit f915b27

Browse files
committed
Relax abort-on-no-typedef-rules condition
1 parent 44a4d04 commit f915b27

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎cpp2rust/converter/rules/registry.cpp‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,7 @@ TypeRuleMatch findType(clang::QualType use) {
315315
if (!best.rule_decl) {
316316
auto spelled = RuleDecls::SpelledTypedef(ctx, use);
317317
if (spelled && !IsUserDefinedDecl(spelled)) {
318-
use.dump(llvm::errs(), ctx);
319-
llvm::report_fatal_error("typedef has no type rule");
318+
return findType(use.getCanonicalType());
320319
}
321320
}
322321
return best;

‎tests/unit/out/refcount/string.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,10 @@ fn main_0() -> i32 {
330330
assert!((((elem!(output_data, 1).read()) as i32) == (('a' as i8) as i32)));
331331
assert!((((elem!(output_data, 2).read()) as i32) == (('s' as i8) as i32)));
332332
assert!((((elem!(output_data, 3).read()) as i32) == (('t' as i8) as i32)));
333+
let mut diff: i64 = (-3_i32 as i64);
334+
assert!((diff < 0_i64));
335+
diff += 6_i64;
336+
assert!((diff == 3_i64));
333337
let mut t0: usize = ((*s1.borrow()).len() - 1);
334338
let mut t1: usize = (t0).wrapping_add(((p1.read()) as usize));
335339
let mut t2: usize = (t1).wrapping_add(((*s2.borrow()).len() - 1));

‎tests/unit/out/unsafe/string.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ unsafe fn main_0() -> i32 {
346346
assert!((((*output_data.offset((1) as isize)) as i32) == (('a' as libc::c_char) as i32)));
347347
assert!((((*output_data.offset((2) as isize)) as i32) == (('s' as libc::c_char) as i32)));
348348
assert!((((*output_data.offset((3) as isize)) as i32) == (('t' as libc::c_char) as i32)));
349+
let mut diff: i64 = (-3_i32 as i64);
350+
assert!(((diff) < (0_i64)));
351+
diff += 6_i64;
352+
assert!(((diff) == (3_i64)));
349353
let mut t0: usize = (s1.len() - 1);
350354
let mut t1: usize = (t0).wrapping_add(((*p1) as usize));
351355
let mut t2: usize = (t1).wrapping_add((s2.len() - 1));

‎tests/unit/string.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ int main() {
138138
assert(output_data[1] == 'a');
139139
assert(output_data[2] == 's');
140140
assert(output_data[3] == 't');
141+
std::string::difference_type diff = -3;
142+
assert(diff < 0);
143+
diff += 6;
144+
assert(diff == 3);
141145

142146
// FIXME
143147
auto t0 = s1.length();

0 commit comments

Comments
 (0)