Skip to content

Commit 0270361

Browse files
committed
refactor
1 parent 8626380 commit 0270361

File tree

11 files changed

+2569
-805
lines changed

11 files changed

+2569
-805
lines changed
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
digraph DemangleTrace {
2+
rankdir=TB;
3+
node [shape=box, fontname="Courier", fontsize=10];
4+
edge [fontname="Arial", fontsize=8];
5+
6+
n0 [label="mangled_name@pos:0\n'_ZNSs4_Rep7_M_grabERKSaIcES2_'\n→ 'std::string::_Rep::_M_grab(std::allocator<char> const&, std::allocator<char> const)'", fillcolor=gold, style="filled,bold", penwidth=3];
7+
n1 [label="encoding@pos:2\n'NSs4_Rep7_M_grabERKSaIcES2_'\n→ 'std::string::_Rep::_M_grab(std::allocator<char> const&, std::allocator<char> const)'", fillcolor=gold, style="filled,bold", penwidth=3];
8+
n2 [label="name@pos:2\n'NSs4_Rep7_M_grabE'\n→ 'std::string::_Rep::_M_grab'", fillcolor=gold, style="filled,bold", penwidth=3];
9+
n3 [label="nested_name@pos:2\n'NSs4_Rep7_M_grabE'\n→ 'std::string::_Rep::_M_grab'", fillcolor=gold, style="filled,bold", penwidth=3];
10+
n4 [label="prefix@pos:3\n'Ss4_Rep'\n→ 'std::string::_Rep'", fillcolor=gold, style="filled,bold", penwidth=3];
11+
n5 [label="prefix_start@pos:3\n'Ss'\n→ 'std::string'", fillcolor=gold, style="filled,bold", penwidth=3];
12+
n6 [label="prefix_start_unit@pos:3\n'Ss'\n→ 'std::string'", fillcolor=gold, style="filled,bold", penwidth=3];
13+
n7 [label="prefix_or_template_prefix_start@pos:3\n'Ss'\n→ 'std::string'", fillcolor=gold, style="filled,bold", penwidth=3];
14+
n8 [label="substitution@pos:3\n'Ss'\n→ 'std::string'", fillcolor=gold, style="filled,bold", penwidth=3];
15+
n9 [label="prefix_start_rr@pos:5\n'4_Rep'", fillcolor=lightcoral, style="filled", penwidth=1];
16+
n10 [label="prefix_nested_class_or_namespace@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=lightcoral, style="filled", penwidth=1];
17+
n11 [label="unqualified_name@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=lightcoral, style="filled", penwidth=1];
18+
n12 [label="source_name@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=lightcoral, style="filled", penwidth=1];
19+
n13 [label="prefix_nested_class_or_namespace@pos:10\n'7_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
20+
n14 [label="unqualified_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
21+
n15 [label="source_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
22+
n16 [label="unqualified_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
23+
n17 [label="source_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
24+
n18 [label="unqualified_name@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=lightcoral, style="filled", penwidth=1];
25+
n19 [label="source_name@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=lightcoral, style="filled", penwidth=1];
26+
n20 [label="prefix_nested_class_or_namespace@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=lightcoral, style="filled", penwidth=1];
27+
n21 [label="unqualified_name@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=lightcoral, style="filled", penwidth=1];
28+
n22 [label="source_name@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=lightcoral, style="filled", penwidth=1];
29+
n23 [label="prefix_nested_class_or_namespace@pos:10\n'7_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
30+
n24 [label="unqualified_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
31+
n25 [label="source_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
32+
n26 [label="unqualified_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
33+
n27 [label="source_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
34+
n28 [label="unqualified_name@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=lightcoral, style="filled", penwidth=1];
35+
n29 [label="source_name@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=lightcoral, style="filled", penwidth=1];
36+
n30 [label="unqualified_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
37+
n31 [label="source_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
38+
n32 [label="unqualified_name@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=lightcoral, style="filled", penwidth=1];
39+
n33 [label="source_name@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=lightcoral, style="filled", penwidth=1];
40+
n34 [label="prefix_nested_class_or_namespace@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=gold, style="filled,bold", penwidth=3];
41+
n35 [label="unqualified_name@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=gold, style="filled,bold", penwidth=3];
42+
n36 [label="source_name@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=gold, style="filled,bold", penwidth=3];
43+
n37 [label="prefix_nested_class_or_namespace@pos:10\n'7_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
44+
n38 [label="unqualified_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
45+
n39 [label="source_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
46+
n40 [label="unqualified_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
47+
n41 [label="source_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=lightcoral, style="filled", penwidth=1];
48+
n42 [label="unqualified_name@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=gold, style="filled,bold", penwidth=3];
49+
n43 [label="source_name@pos:5\n'4_Rep'\n→ '_Rep'", fillcolor=gold, style="filled,bold", penwidth=3];
50+
n44 [label="unqualified_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=gold, style="filled,bold", penwidth=3];
51+
n45 [label="source_name@pos:10\n'7_M_grab'\n→ '_M_grab'", fillcolor=gold, style="filled,bold", penwidth=3];
52+
n46 [label="bare_function_type@pos:19\n'RKSaIcES2_'\n→ 'std::allocator<char> const&, std::allocator<char> const'", fillcolor=gold, style="filled,bold", penwidth=3];
53+
n47 [label="type@pos:19\n'RKSaIcE'\n→ 'std::allocator<char> const&'", fillcolor=gold, style="filled,bold", penwidth=3];
54+
n48 [label="type@pos:20\n'KSaIcE'\n→ 'std::allocator<char> const'", fillcolor=gold, style="filled,bold", penwidth=3];
55+
n49 [label="type@pos:21\n'SaIcE'\n→ 'std::allocator<char>'", fillcolor=gold, style="filled,bold", penwidth=3];
56+
n50 [label="substitution@pos:21\n'Sa'\n→ 'std::allocator'", fillcolor=lightgreen, style="filled", penwidth=1];
57+
n51 [label="template_args@pos:23\n'IcE'\n→ '<char>'", fillcolor=gold, style="filled,bold", penwidth=3];
58+
n52 [label="template_arg@pos:24\n'c'\n→ 'char'", fillcolor=gold, style="filled,bold", penwidth=3];
59+
n53 [label="type@pos:24\n'c'\n→ 'char'", fillcolor=gold, style="filled,bold", penwidth=3];
60+
n54 [label="builtin_type@pos:24\n'c'\n→ 'char'", fillcolor=gold, style="filled,bold", penwidth=3];
61+
n55 [label="type@pos:26\n'S2_'\n→ 'std::allocator<char> const'", fillcolor=gold, style="filled,bold", penwidth=3];
62+
n56 [label="substitution@pos:26\n'S2_'\n→ 'std::allocator<char> const'", fillcolor=lightgreen, style="filled", penwidth=1];
63+
n57 [label="seq_id@pos:27\n''", fillcolor=lightblue, style="filled", penwidth=1];
64+
n58 [label="class_enum_type@pos:26\n''", fillcolor=lightcoral, style="filled", penwidth=1];
65+
n59 [label="name@pos:26\n'S2_'", fillcolor=lightcoral, style="filled", penwidth=1];
66+
n60 [label="substitution@pos:26\n'S2_'\n→ 'std::allocator<char> const'", fillcolor=lightcoral, style="filled", penwidth=1];
67+
n61 [label="seq_id@pos:27\n''", fillcolor=lightcoral, style="filled", penwidth=1];
68+
n62 [label="substitution@pos:26\n'S2_'\n→ 'std::allocator<char> const'", fillcolor=gold, style="filled,bold", penwidth=3];
69+
n63 [label="seq_id@pos:27\n''", fillcolor=lightblue, style="filled", penwidth=1];
70+
n64 [label="type@pos:29\n''", fillcolor=lightcoral, style="filled", penwidth=1];
71+
n65 [label="class_enum_type@pos:29\n''", fillcolor=lightcoral, style="filled", penwidth=1];
72+
n66 [label="name@pos:29\n''", fillcolor=lightcoral, style="filled", penwidth=1];
73+
n67 [label="unscoped_name@pos:29\n''", fillcolor=lightcoral, style="filled", penwidth=1];
74+
n68 [label="unqualified_name@pos:29\n''", fillcolor=lightcoral, style="filled", penwidth=1];
75+
n69 [label="source_name@pos:29\n''", fillcolor=lightcoral, style="filled", penwidth=1];
76+
n70 [label="unscoped_name@pos:29\n''", fillcolor=lightcoral, style="filled", penwidth=1];
77+
n71 [label="unqualified_name@pos:29\n''", fillcolor=lightcoral, style="filled", penwidth=1];
78+
n72 [label="source_name@pos:29\n''", fillcolor=lightcoral, style="filled", penwidth=1];
79+
80+
n0 -> n1 [color=gold, style=solid, penwidth=3];
81+
n1 -> n2 [color=gold, style=solid, penwidth=3];
82+
n2 -> n3 [color=gold, style=solid, penwidth=3];
83+
n3 -> n4 [color=gold, style=solid, penwidth=3];
84+
n4 -> n5 [color=gold, style=solid, penwidth=3];
85+
n5 -> n6 [color=gold, style=solid, penwidth=3];
86+
n6 -> n7 [color=gold, style=solid, penwidth=3];
87+
n7 -> n8 [color=gold, style=solid, penwidth=3];
88+
n5 -> n9 [color=red, style=solid, penwidth=1];
89+
n9 -> n10 [color=red, style=solid, penwidth=1];
90+
n10 -> n11 [color=red, style=solid, penwidth=1];
91+
n11 -> n12 [color=red, style=solid, penwidth=1];
92+
n10 -> n13 [color=red, style=solid, penwidth=1];
93+
n13 -> n14 [color=red, style=solid, penwidth=1];
94+
n14 -> n15 [color=red, style=solid, penwidth=1];
95+
n13 -> n16 [color=red, style=solid, penwidth=1];
96+
n16 -> n17 [color=red, style=solid, penwidth=1];
97+
n10 -> n18 [color=red, style=solid, penwidth=1];
98+
n18 -> n19 [color=red, style=solid, penwidth=1];
99+
n9 -> n20 [color=red, style=solid, penwidth=1];
100+
n20 -> n21 [color=red, style=solid, penwidth=1];
101+
n21 -> n22 [color=red, style=solid, penwidth=1];
102+
n20 -> n23 [color=red, style=solid, penwidth=1];
103+
n23 -> n24 [color=red, style=solid, penwidth=1];
104+
n24 -> n25 [color=red, style=solid, penwidth=1];
105+
n23 -> n26 [color=red, style=solid, penwidth=1];
106+
n26 -> n27 [color=red, style=solid, penwidth=1];
107+
n20 -> n28 [color=red, style=solid, penwidth=1];
108+
n28 -> n29 [color=red, style=solid, penwidth=1];
109+
n9 -> n30 [color=red, style=solid, penwidth=1];
110+
n30 -> n31 [color=red, style=solid, penwidth=1];
111+
n9 -> n32 [color=red, style=solid, penwidth=1];
112+
n32 -> n33 [color=red, style=solid, penwidth=1];
113+
n4 -> n34 [color=gold, style=solid, penwidth=3];
114+
n34 -> n35 [color=gold, style=solid, penwidth=3];
115+
n35 -> n36 [color=gold, style=solid, penwidth=3];
116+
n34 -> n37 [color=red, style=solid, penwidth=1];
117+
n37 -> n38 [color=red, style=solid, penwidth=1];
118+
n38 -> n39 [color=red, style=solid, penwidth=1];
119+
n37 -> n40 [color=red, style=solid, penwidth=1];
120+
n40 -> n41 [color=red, style=solid, penwidth=1];
121+
n34 -> n42 [color=gold, style=solid, penwidth=3];
122+
n42 -> n43 [color=gold, style=solid, penwidth=3];
123+
n3 -> n44 [color=gold, style=solid, penwidth=3];
124+
n44 -> n45 [color=gold, style=solid, penwidth=3];
125+
n1 -> n46 [color=gold, style=solid, penwidth=3];
126+
n46 -> n47 [color=gold, style=solid, penwidth=3];
127+
n47 -> n48 [color=gold, style=solid, penwidth=3];
128+
n48 -> n49 [color=gold, style=solid, penwidth=3];
129+
n49 -> n50 [color=green, style=solid, penwidth=1];
130+
n49 -> n51 [color=gold, style=solid, penwidth=3];
131+
n51 -> n52 [color=gold, style=solid, penwidth=3];
132+
n52 -> n53 [color=gold, style=solid, penwidth=3];
133+
n53 -> n54 [color=gold, style=solid, penwidth=3];
134+
n46 -> n55 [color=gold, style=solid, penwidth=3];
135+
n55 -> n56 [color=green, style=solid, penwidth=1];
136+
n56 -> n57 [color=black, style=solid, penwidth=1];
137+
n55 -> n58 [color=red, style=solid, penwidth=1];
138+
n58 -> n59 [color=red, style=solid, penwidth=1];
139+
n59 -> n60 [color=red, style=solid, penwidth=1];
140+
n60 -> n61 [color=red, style=solid, penwidth=1];
141+
n55 -> n62 [color=gold, style=solid, penwidth=3];
142+
n62 -> n63 [color=black, style=solid, penwidth=1];
143+
n46 -> n64 [color=red, style=solid, penwidth=1];
144+
n64 -> n65 [color=red, style=solid, penwidth=1];
145+
n65 -> n66 [color=red, style=solid, penwidth=1];
146+
n66 -> n67 [color=red, style=solid, penwidth=1];
147+
n67 -> n68 [color=red, style=solid, penwidth=1];
148+
n68 -> n69 [color=red, style=solid, penwidth=1];
149+
n66 -> n70 [color=red, style=solid, penwidth=1];
150+
n70 -> n71 [color=red, style=solid, penwidth=1];
151+
n71 -> n72 [color=red, style=solid, penwidth=1];
152+
153+
// Legend
154+
subgraph cluster_legend {
155+
label="Legend";
156+
style=filled;
157+
fillcolor=white;
158+
legend_final_path [label="Final Path", fillcolor=gold, style="filled,bold", penwidth=3];
159+
legend_success [label="Success", fillcolor=lightgreen, style=filled];
160+
legend_failed [label="Failed", fillcolor=lightcoral, style=filled];
161+
legend_backtrack [label="Backtracked", fillcolor=orange, style="filled,dashed"];
162+
legend_running [label="Running", fillcolor=lightblue, style=filled];
163+
}
164+
165+
// Substitution Table
166+
subgraph cluster_substitutions {
167+
label="Detected Substitutable Types";
168+
style=filled;
169+
fillcolor=lightyellow;
170+
pencolor=black;
171+
fontname="Arial";
172+
fontsize=12;
173+
substitution_table [shape=plaintext, label=<
174+
<TABLE BORDER="1" CELLBORDER="1" CELLSPACING="0" BGCOLOR="white">
175+
<TR>
176+
<TD BGCOLOR="lightgray"><B>Index</B></TD>
177+
<TD BGCOLOR="lightgray"><B>Substitution</B></TD>
178+
<TD BGCOLOR="lightgray"><B>Type</B></TD>
179+
<TD BGCOLOR="lightgray"><B>Parts</B></TD>
180+
</TR>
181+
<TR>
182+
<TD>0</TD>
183+
<TD><FONT FACE="Courier">S_</FONT></TD>
184+
<TD><FONT FACE="Courier">std::string</FONT></TD>
185+
<TD>2</TD>
186+
</TR>
187+
<TR>
188+
<TD>1</TD>
189+
<TD><FONT FACE="Courier">S0_</FONT></TD>
190+
<TD><FONT FACE="Courier">std::string::_Rep</FONT></TD>
191+
<TD>3</TD>
192+
</TR>
193+
<TR>
194+
<TD>2</TD>
195+
<TD><FONT FACE="Courier">S1_</FONT></TD>
196+
<TD><FONT FACE="Courier">std::allocator&lt;char&gt;</FONT></TD>
197+
<TD>2</TD>
198+
</TR>
199+
<TR>
200+
<TD>3</TD>
201+
<TD><FONT FACE="Courier">S2_</FONT></TD>
202+
<TD><FONT FACE="Courier">std::allocator&lt;char&gt; const</FONT></TD>
203+
<TD>2</TD>
204+
</TR>
205+
<TR>
206+
<TD>4</TD>
207+
<TD><FONT FACE="Courier">S3_</FONT></TD>
208+
<TD><FONT FACE="Courier">std::allocator&lt;char&gt; const&amp;</FONT></TD>
209+
<TD>2</TD>
210+
</TR>
211+
</TABLE>
212+
>];
213+
}
214+
}

meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ libdemangle_src = [
1111
'src' / 'cplusplus' / 'demangle.c',
1212
'src' / 'cplusplus' / 'common.c',
1313
'src' / 'cplusplus' / 'param.c',
14+
'src' / 'cplusplus' / 'meta.c',
15+
'src' / 'cplusplus' / 'trace_graph.c',
16+
'src' / 'cplusplus' / 'parser_combinator.c',
1417
'src' / 'cplusplus' / 'v2.c',
1518
'src' / 'cplusplus' / 'v3.c',
1619

0 commit comments

Comments
 (0)