Skip to content

Commit 963883e

Browse files
committed
Allow inheriting constructor types to be substitution candidates.
Fixes #286.
1 parent 04954c0 commit 963883e

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/ast.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3277,13 +3277,13 @@ impl Parse for VOffset {
32773277
#[derive(Clone, Debug, PartialEq, Eq)]
32783278
pub enum CtorDtorName {
32793279
/// "C1", the "complete object constructor"
3280-
CompleteConstructor(Option<Box<Name>>),
3280+
CompleteConstructor(Option<TypeHandle>),
32813281
/// "C2", the "base object constructor"
3282-
BaseConstructor(Option<Box<Name>>),
3282+
BaseConstructor(Option<TypeHandle>),
32833283
/// "C3", the "complete object allocating constructor"
3284-
CompleteAllocatingConstructor(Option<Box<Name>>),
3284+
CompleteAllocatingConstructor(Option<TypeHandle>),
32853285
/// "C4", the "maybe in-charge constructor"
3286-
MaybeInChargeConstructor(Option<Box<Name>>),
3286+
MaybeInChargeConstructor(Option<TypeHandle>),
32873287
/// "D0", the "deleting destructor"
32883288
DeletingDestructor,
32893289
/// "D1", the "complete object destructor"
@@ -3295,7 +3295,7 @@ pub enum CtorDtorName {
32953295
}
32963296

32973297
impl CtorDtorName {
3298-
fn inheriting_mut(&mut self) -> &mut Option<Box<Name>> {
3298+
fn inheriting_mut(&mut self) -> &mut Option<TypeHandle> {
32993299
match self {
33003300
CtorDtorName::CompleteConstructor(ref mut inheriting)
33013301
| CtorDtorName::BaseConstructor(ref mut inheriting)
@@ -3354,8 +3354,8 @@ impl Parse for CtorDtorName {
33543354
}?;
33553355

33563356
if inheriting {
3357-
let (ty, tail) = Name::parse(ctx, subs, tail)?;
3358-
*ctor_type.inheriting_mut() = Some(Box::new(ty));
3357+
let (ty, tail) = TypeHandle::parse(ctx, subs, tail)?;
3358+
*ctor_type.inheriting_mut() = Some(ty);
33593359
Ok((ctor_type, tail))
33603360
} else {
33613361
Ok((ctor_type, tail))

tests/tests.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,12 @@ demangles!(
611611
"nsresult mozilla::extensions::AtomSet::Get<&(mozilla::extensions::WILDCARD_SCHEMES.<char const* at offset 0>)>(RefPtr<mozilla::extensions::AtomSet>&)"
612612
);
613613

614+
// Test that inheriting constructor types are eligible for substitution.
615+
demangles!(
616+
_ZN6deluge3gui9menu_item15MasterTransposeCI18MenuItemERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESB_,
617+
"deluge::gui::menu_item::MasterTranspose::MenuItem(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)"
618+
);
619+
614620
// This symbol previously ran into some mutual recursion and unbounded growth of the substitution table.
615621
// See <https://github.com/gimli-rs/cpp_demangle/issues/277> and <https://github.com/getsentry/symbolic/issues/477>
616622
#[test]

0 commit comments

Comments
 (0)