Skip to content

Commit bc7fb97

Browse files
plafosseclaude
andcommitted
GNU3 demangler: remove dead code and unused function
- Remove unreachable C1-C5/D0-D5 cases from GetNameType() — these are handled directly by DemangleUnqualifiedName's own case blocks - Remove unused DemangleInitializer() (declaration and definition) - Remove dead "." operator check in DemangleBinaryExpression — the dt (member access) operator has its own handler in DemangleExpression Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b5022be commit bc7fb97

2 files changed

Lines changed: 3 additions & 28 deletions

File tree

demangler/gnu3/demangle_gnu3.cpp

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,9 @@ static BNNameType GetNameType(char elm1, char elm2)
209209
case hash('d','a'): return OperatorDeleteArrayNameType; // delete[]
210210
case hash('n','w'): return OperatorNewNameType; // new
211211
case hash('n','a'): return OperatorNewArrayNameType; // new []
212-
case hash('C','1'): return ConstructorNameType;
213-
case hash('C','2'): return ConstructorNameType;
214-
case hash('C','3'): return ConstructorNameType;
215-
case hash('C','4'): return ConstructorNameType;
216-
case hash('C','5'): return ConstructorNameType;
217-
case hash('D','0'): return DestructorNameType;
218-
case hash('D','1'): return DestructorNameType;
219-
case hash('D','2'): return DestructorNameType;
220-
case hash('D','3'): return DestructorNameType;
221-
case hash('D','4'): return DestructorNameType;
222-
case hash('D','5'): return DestructorNameType;
212+
// Note: C1-C5 (constructor) and D0-D5 (destructor) are handled directly
213+
// by DemangleUnqualifiedName with their own case blocks, so they never
214+
// reach GetNameType.
223215
default:
224216
return NoNameType;
225217
}
@@ -992,20 +984,6 @@ int64_t DemangleGNU3::DemangleNumber()
992984
}
993985

994986

995-
string DemangleGNU3::DemangleInitializer()
996-
{
997-
string out;
998-
if (m_reader.ReadString(2) != "pi")
999-
throw DemangleException();
1000-
out += "(";
1001-
while (m_reader.Peek() != 'E')
1002-
out += DemangleExpression();
1003-
m_reader.Consume();
1004-
out += ")";
1005-
return out;
1006-
}
1007-
1008-
1009987
string DemangleGNU3::DemanglePrimaryExpression()
1010988
{
1011989
indent();
@@ -1139,8 +1117,6 @@ string DemangleGNU3::DemangleBinaryExpression(const string& op)
11391117
const string lhs = "(" + DemangleExpression() + ")";
11401118
const string rhs = "(" + DemangleExpression() + ")";
11411119
dedent();
1142-
if (op == ".")
1143-
return lhs + op + rhs;
11441120
return lhs + " " + op + " " + rhs;
11451121
}
11461122

demangler/gnu3/demangle_gnu3.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ class DemangleGNU3
133133
DemangledTypeNode DemangleUnqualifiedName();
134134
_STD_STRING DemangleSourceName();
135135
_STD_STRING DemangleNumberAsString();
136-
_STD_STRING DemangleInitializer();
137136
_STD_STRING DemangleExpression();
138137
_STD_STRING DemanglePrimaryExpression();
139138
DemangledTypeNode DemangleName();

0 commit comments

Comments
 (0)