@@ -7,7 +7,7 @@ use super::item::Item;
7
7
use super :: traversal:: { EdgeKind , Trace , Tracer } ;
8
8
use super :: ty:: TypeKind ;
9
9
use crate :: callbacks:: { ItemInfo , ItemKind } ;
10
- use crate :: clang:: { self , Attribute } ;
10
+ use crate :: clang:: { self , ABIKind , Attribute } ;
11
11
use crate :: parse:: { ClangSubItemParser , ParseError , ParseResult } ;
12
12
use clang_sys:: { self , CXCallingConv } ;
13
13
@@ -324,11 +324,12 @@ pub(crate) fn cursor_mangling(
324
324
return None ;
325
325
}
326
326
327
+ let is_itanium_abi = ctx. abi_kind ( ) == ABIKind :: GenericItanium ;
327
328
let is_destructor = cursor. kind ( ) == clang_sys:: CXCursor_Destructor ;
328
329
if let Ok ( mut manglings) = cursor. cxx_manglings ( ) {
329
330
while let Some ( m) = manglings. pop ( ) {
330
331
// Only generate the destructor group 1, see below.
331
- if is_destructor && !m. ends_with ( "D1Ev" ) {
332
+ if is_itanium_abi && is_destructor && !m. ends_with ( "D1Ev" ) {
332
333
continue ;
333
334
}
334
335
@@ -341,7 +342,7 @@ pub(crate) fn cursor_mangling(
341
342
return None ;
342
343
}
343
344
344
- if is_destructor {
345
+ if is_itanium_abi && is_destructor {
345
346
// With old (3.8-) libclang versions, and the Itanium ABI, clang returns
346
347
// the "destructor group 0" symbol, which means that it'll try to free
347
348
// memory, which definitely isn't what we want.
0 commit comments