Check if a C++/CUDA template_declaration wraps a class/struct/union (not a function).
| 11502 | |
| 11503 | // Check if a C++/CUDA template_declaration wraps a class/struct/union (not a function). |
| 11504 | static bool is_template_class_node(TSNode node, CBMLanguage lang) { |
| 11505 | if ((lang != CBM_LANG_CPP && lang != CBM_LANG_CUDA) || |
| 11506 | strcmp(ts_node_type(node), "template_declaration") != 0) { |
| 11507 | return false; |
| 11508 | } |
| 11509 | uint32_t nc = ts_node_named_child_count(node); |
| 11510 | for (uint32_t i = 0; i < nc; i++) { |
| 11511 | const char *ck = ts_node_type(ts_node_named_child(node, i)); |
| 11512 | if (strcmp(ck, "class_specifier") == 0 || strcmp(ck, "struct_specifier") == 0 || |
| 11513 | strcmp(ck, "union_specifier") == 0) { |
| 11514 | return true; |
| 11515 | } |
| 11516 | } |
| 11517 | return false; |
| 11518 | } |
| 11519 | |
| 11520 | // Compute the enclosing class/namespace QN for a scoped node. |
| 11521 | /* A namespace contributes a QN segment so a symbol declared in `namespace ns` |