Skip to content

Commit 294c9a1

Browse files
committed
feat: add mangled_name field for SourceCode
close #45
1 parent cfe98b5 commit 294c9a1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/functions/utils.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ pub struct SourceCode {
1414
/// Function name.
1515
pub name: String,
1616

17+
/// Mangled function name.
18+
pub mangled_name: String,
19+
1720
/// String of [`InstanceKind`].
1821
///
1922
/// [`InstanceKind`]: https://doc.rust-lang.org/nightly/nightly-rustc/stable_mir/mir/mono/enum.InstanceKind.html
@@ -41,6 +44,7 @@ pub struct SourceCode {
4144
impl SourceCode {
4245
pub fn with_hasher(&self, hasher: &mut StableHasher<SipHasher128>) {
4346
hasher.write_str(&self.name);
47+
hasher.write_str(&self.mangled_name);
4448
hasher.write_str(&self.kind);
4549
hasher.write_str(&self.file);
4650
hasher.write_str(&self.src);
@@ -88,6 +92,7 @@ pub fn source_code_with(
8892
}
8993

9094
let name = inst.name();
95+
let mangled_name = inst.mangled_name();
9196
let kind = format!("{:?}", inst.kind);
92-
SourceCode { name, kind, file, src, before_expansion }
97+
SourceCode { name, mangled_name, kind, file, src, before_expansion }
9398
}

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ pub struct SourceCode {
2828
/// Function name.
2929
pub name: String,
3030

31+
/// Mangled function name.
32+
pub mangled_name: String,
33+
3134
/// String of [`InstanceKind`].
3235
///
3336
/// [`InstanceKind`]: https://doc.rust-lang.org/nightly/nightly-rustc/stable_mir/mir/mono/enum.InstanceKind.html

0 commit comments

Comments
 (0)