diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/codegen/mod.rs | 1 | ||||
-rw-r--r-- | src/ir/function.rs | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 0ad4e805..f9e5e77c 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -1991,6 +1991,7 @@ impl MethodCodegen for Method { } }); + // TODO(emilio): We could generate final stuff at least. if self.is_virtual() { return; // FIXME } diff --git a/src/ir/function.rs b/src/ir/function.rs index b39c92b7..f027e47c 100644 --- a/src/ir/function.rs +++ b/src/ir/function.rs @@ -245,6 +245,7 @@ pub fn cursor_mangling( cursor: &clang::Cursor, ) -> Option<String> { use clang_sys; + if !ctx.options().enable_mangling { return None; } @@ -256,8 +257,14 @@ pub fn cursor_mangling( return None; } + let is_destructor = cursor.kind() == clang_sys::CXCursor_Destructor; if let Ok(mut manglings) = cursor.cxx_manglings() { - if let Some(m) = manglings.pop() { + while let Some(m) = manglings.pop() { + // Only generate the destructor group 1, see below. + if is_destructor && !m.ends_with("D1Ev") { + continue; + } + return Some(m); } } @@ -267,7 +274,7 @@ pub fn cursor_mangling( return None; } - if cursor.kind() == clang_sys::CXCursor_Destructor { + if is_destructor { // With old (3.8-) libclang versions, and the Itanium ABI, clang returns // the "destructor group 0" symbol, which means that it'll try to free // memory, which definitely isn't what we want. |