Drop the entries a branch view re-extracted from code outside the * conditionals: a definition with a QN the file already has at the same line, * an import with the same name and path. */
| 3322 | * conditionals: a definition with a QN the file already has at the same line, |
| 3323 | * an import with the same name and path. */ |
| 3324 | static void cpp_view_drop_seen(CBMFileResult *r, int defs_before, int imports_before) { |
| 3325 | int w = defs_before; |
| 3326 | for (int i = defs_before; i < r->defs.count; i++) { |
| 3327 | const CBMDefinition *d = &r->defs.items[i]; |
| 3328 | bool seen = false; |
| 3329 | for (int j = 0; j < w && !seen; j++) { |
| 3330 | const CBMDefinition *e = &r->defs.items[j]; |
| 3331 | seen = e->start_line == d->start_line && e->qualified_name && d->qualified_name && |
| 3332 | strcmp(e->qualified_name, d->qualified_name) == 0; |
| 3333 | } |
| 3334 | if (!seen) { |
| 3335 | r->defs.items[w++] = *d; |
| 3336 | } |
| 3337 | } |
| 3338 | r->defs.count = w; |
| 3339 | w = imports_before; |
| 3340 | for (int i = imports_before; i < r->imports.count; i++) { |
| 3341 | const CBMImport *m = &r->imports.items[i]; |
| 3342 | bool seen = false; |
| 3343 | for (int j = 0; j < w && !seen; j++) { |
| 3344 | const CBMImport *e = &r->imports.items[j]; |
| 3345 | seen = e->local_name && m->local_name && e->module_path && m->module_path && |
| 3346 | strcmp(e->local_name, m->local_name) == 0 && |
| 3347 | strcmp(e->module_path, m->module_path) == 0; |
| 3348 | } |
| 3349 | if (!seen) { |
| 3350 | r->imports.items[w++] = *m; |
| 3351 | } |
| 3352 | } |
| 3353 | r->imports.count = w; |
| 3354 | } |
| 3355 | |
| 3356 | /* Haskell: the scanner parses the first branch of an #if group and swallows |
| 3357 | * the rest up to #endif as one token, so what is written once per |
no outgoing calls
no test coverage detected