Consolidate the functions used to generate the cc test filter

Roboleaf mode needs a binary to generate the cc test filter. To reuse
as much existing implementation as possible, we should consolidate
those logics into one helper and reuse it in the dedicated cc test
filter generator binary for Roboleaf mode.

Test: atest-dev HelloWorldTest#PrintHelloWorld
Bug: 298284364
Change-Id: Ib60f01a7bffeccf533b5d791ca94da05d28d4231
4 files changed