@@ -1157,6 +1157,40 @@ static bool CompareFunctionTypes(const AnyFunctionType *f,
1157
1157
return (in_matches && out_matches);
1158
1158
}
1159
1159
1160
+ static void VisitNodePrivateDeclName (
1161
+ ASTContext *ast,
1162
+ Demangle::NodePointer parent_node,
1163
+ Demangle::NodePointer cur_node, VisitNodeResult &result) {
1164
+ DeclKind decl_kind = GetKindAsDeclKind (parent_node->getKind ());
1165
+
1166
+ if (cur_node->getNumChildren () != 2 ) {
1167
+ if (result._error .empty ())
1168
+ result._error = stringWithFormat (
1169
+ " unable to retrieve content for Node::Kind::PrivateDeclName" );
1170
+ return ;
1171
+ }
1172
+
1173
+ Demangle::NodePointer priv_decl_id_node (cur_node->getChild (0 ));
1174
+ Demangle::NodePointer id_node (cur_node->getChild (1 ));
1175
+
1176
+ if (!priv_decl_id_node->hasText () || !id_node->hasText ()) {
1177
+ if (result._error .empty ())
1178
+ result._error = stringWithFormat (
1179
+ " unable to retrieve content for Node::Kind::PrivateDeclName" );
1180
+ return ;
1181
+ }
1182
+
1183
+ if (!FindFirstNamedDeclWithKind (ast, ast->getIdentifier (id_node->getText ()),
1184
+ decl_kind, result,
1185
+ priv_decl_id_node->getText ().str ())) {
1186
+ if (result._error .empty ())
1187
+ result._error = stringWithFormat (
1188
+ " unable to find Node::Kind::PrivateDeclName '%s' in '%s'" ,
1189
+ id_node->getText ().str ().c_str (),
1190
+ priv_decl_id_node->getText ().str ().c_str ());
1191
+ }
1192
+ }
1193
+
1160
1194
// VisitNodeFunction gets used for Function, Variable and Allocator:
1161
1195
static void VisitNodeFunction (
1162
1196
ASTContext *ast,
@@ -1191,6 +1225,25 @@ static void VisitNodeFunction(
1191
1225
VisitNode (ast, *pos, decl_scope_result);
1192
1226
break ;
1193
1227
1228
+ case Demangle::Node::Kind::PrivateDeclName: {
1229
+ VisitNodePrivateDeclName (ast, cur_node, child, decl_scope_result);
1230
+
1231
+ // No results found, giving up.
1232
+ if (decl_scope_result._decls .empty ())
1233
+ break ;
1234
+
1235
+ std::copy (decl_scope_result._decls .begin (),
1236
+ decl_scope_result._decls .end (),
1237
+ back_inserter (identifier_result._decls ));
1238
+ std::copy (decl_scope_result._types .begin (),
1239
+ decl_scope_result._types .end (),
1240
+ back_inserter (identifier_result._types ));
1241
+ identifier_result._module = decl_scope_result._module ;
1242
+ if (decl_scope_result._decls .size () == 1 )
1243
+ found_univocous = true ;
1244
+ break ;
1245
+ }
1246
+
1194
1247
case Demangle::Node::Kind::LabelList: {
1195
1248
for (const auto &label : **pos) {
1196
1249
if (label->getKind () == Demangle::Node::Kind::FirstElementMarker)
@@ -1670,40 +1723,6 @@ static void VisitNodeLocalDeclName(
1670
1723
}
1671
1724
}
1672
1725
1673
- static void VisitNodePrivateDeclName (
1674
- ASTContext *ast,
1675
- Demangle::NodePointer parent_node,
1676
- Demangle::NodePointer cur_node, VisitNodeResult &result) {
1677
- DeclKind decl_kind = GetKindAsDeclKind (parent_node->getKind ());
1678
-
1679
- if (cur_node->getNumChildren () != 2 ) {
1680
- if (result._error .empty ())
1681
- result._error = stringWithFormat (
1682
- " unable to retrieve content for Node::Kind::PrivateDeclName" );
1683
- return ;
1684
- }
1685
-
1686
- Demangle::NodePointer priv_decl_id_node (cur_node->getChild (0 ));
1687
- Demangle::NodePointer id_node (cur_node->getChild (1 ));
1688
-
1689
- if (!priv_decl_id_node->hasText () || !id_node->hasText ()) {
1690
- if (result._error .empty ())
1691
- result._error = stringWithFormat (
1692
- " unable to retrieve content for Node::Kind::PrivateDeclName" );
1693
- return ;
1694
- }
1695
-
1696
- if (!FindFirstNamedDeclWithKind (ast, ast->getIdentifier (id_node->getText ()),
1697
- decl_kind, result,
1698
- priv_decl_id_node->getText ().str ())) {
1699
- if (result._error .empty ())
1700
- result._error = stringWithFormat (
1701
- " unable to find Node::Kind::PrivateDeclName '%s' in '%s'" ,
1702
- id_node->getText ().str ().c_str (),
1703
- priv_decl_id_node->getText ().str ().c_str ());
1704
- }
1705
- }
1706
-
1707
1726
static void VisitNodeRelatedEntityDeclName (
1708
1727
ASTContext *ast,
1709
1728
Demangle::NodePointer parent_node,
0 commit comments