My gcno/gcda files contain some of sources multiple times and sometimes they have different paths formats.
For example
llvm-cov gcov test_unit_MXR_Settings_SettingsEngine_CSettingsHandler.dir/__/__/__/src/CSettingsHandler.cpp.gcno -b -x -i | grep CSettingsHandler.cpp File '../../../src/Settings/SettingsEngine/test/unit_test/CSettingsHandler/../../../src/CSettingsHandler.cpp' Lines executed:75.00% of 8 Branches executed:100.00% of 12 Taken at least once:41.67% of 12 No calls -- File '../../../src/Settings/SettingsEngine/src/CSettingsHandler.cpp' Lines executed:98.37% of 184 Branches executed:97.34% of 601 Taken at least once:56.91% of 601 No calls
llvm-cov randomly takes one of records and adds it to cov-file.
That is why my coverage results usually wrong and furthermore they differ every now and than
My patch unifies filenames, so coverage results are merged.
llvm-cov gcov /home/tenta4/work/arcreator/mxr2/build/build_products_cov/build_host_release/src/Settings/SettingsEngine/test/unit_test/CSettingsHandler/CMakeFiles/test_unit_MXR_Settings_SettingsEngine_CSettingsHandler.dir/__/__/__/src/CSettingsHandler.cpp.gcno -b -x -i | grep CSettingsHandler.cpp -A5 File '../../../src/Settings/SettingsEngine/src/CSettingsHandler.cpp' Lines executed:97.37% of 190 Branches executed:97.39% of 613 Taken at least once:56.61% of 613 No calls
Why not SmallString<256> P(filename)?
Regardless, it might help readability to add a function named something like "addNormalizedPathToMap" that does this and calls emplace as below rather than doing this all inline here.