Skip to content
Merged
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
111 changes: 47 additions & 64 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mod tests;

lazy_static! {
// NOTE: Use [[:alnum::]] instead of \w to only match ASCII word characters, not unicode
static ref MANGLED_NAME_PATTERN: Regex = Regex::new(r"_ZN[\$\._[:alnum:]]*").unwrap();
static ref MANGLED_NAME_PATTERN: Regex = Regex::new(r"_(ZN|R)[\$\._[:alnum:]]*").unwrap();
}

#[inline] // Except for the nested functions (which don't count), this is a very small function
Expand Down
16 changes: 15 additions & 1 deletion src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ static MANGLED_NAMES: &'static [&'static str] = &[
"_ZN109_$LT$core..str..pattern..CharSearcher$LT$$u27$a$GT$$u20$as$u20$core..str..pattern..Searcher$LT$$u27$a$GT$$GT$10next_match17h9c8d80a58da7cd74E",
"_ZN84_$LT$core..iter..Map$LT$I$C$$u20$F$GT$$u20$as$u20$core..iter..iterator..Iterator$GT$4next17h98ea4751a6975428E",
"_ZN51_$LT$serde_json..read..IteratorRead$LT$Iter$GT$$GT$15parse_str_bytes17h8199b7867f1a334fE",
"_ZN3std11collections4hash3map11RandomState3new4KEYS7__getit5__KEY17h1bc0dbd302b9f01bE"
"_ZN3std11collections4hash3map11RandomState3new4KEYS7__getit5__KEY17h1bc0dbd302b9f01bE",

// RFC2603 v0 mangled names
"_RNvNtNtCs1234_7mycrate3foo3bar3baz",
"_RNvNvMCs1234_7mycrateINtCs1234_7mycrate3FoopE3bar4QUUX",
"_RNvNvXCs1234_7mycrateINtCs1234_7mycrate3FoopENtNtC3std5clone5Clone5clone4QUUX",
"_RNvNvCs1234_7mycrate4QUUX3FOO",
];

#[test]
fn ignores_text() {
for text in &["boom de yada\tboom de yada\n", "bananas are fun for everyone"] {
Expand All @@ -32,6 +39,13 @@ fn standalone_demangles() {
}
}

#[test]
fn not_noop_demangles() {
for name in MANGLED_NAMES {
assert_ne!(demangle_line(name, false).as_ref(), *name);
}
}

#[test]
fn standalone_demangles_nohash() {
for name in MANGLED_NAMES {
Expand Down