Skip to content

Commit

Permalink
Merge pull request #46 from fitzgen/libiberty-test-compat
Browse files Browse the repository at this point in the history
Match libiberty's binary operator demangling
  • Loading branch information
fitzgen committed Feb 10, 2017
2 parents a7fc767 + 88b8830 commit 0b39f81
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn test_afl_seed_{}() {{
// Ratcheting number that is increased as more libiberty tests start
// passing. Once they are all passing, this can be removed and we can enable all
// of them by default.
const LIBIBERTY_TEST_THRESHOLD: usize = 20;
const LIBIBERTY_TEST_THRESHOLD: usize = 24;

/// Read `tests/libiberty-demangle-expected`, parse its input mangled symbols,
/// and expected output demangled symbols, and generate test cases for them.
Expand Down
9 changes: 6 additions & 3 deletions src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3201,11 +3201,14 @@ impl Demangle for Expression {
expr.demangle(ctx, stack)
}
Expression::Binary(ref op, ref lhs, ref rhs) => {
try!(write!(ctx, "("));
try!(lhs.demangle(ctx, stack));
try!(write!(ctx, " "));
try!(write!(ctx, ")"));
try!(op.demangle(ctx, stack));
try!(write!(ctx, " "));
rhs.demangle(ctx, stack)
try!(write!(ctx, "("));
try!(rhs.demangle(ctx, stack));
try!(write!(ctx, ")"));
Ok(())
}
Expression::Ternary(OperatorName::Question,
ref condition,
Expand Down

0 comments on commit 0b39f81

Please sign in to comment.