Skip to content

Commit 5a39be8

Browse files
authored
add hook for manually adding coverage data (#41904)
This would allow packages like JuliaInterpreter to properly report coverage data.
1 parent f738580 commit 5a39be8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/codegen.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,6 +1897,16 @@ static void coverageAllocLine(StringRef filename, int line)
18971897
allocLine(coverageData[filename], line);
18981898
}
18991899

1900+
extern "C" JL_DLLEXPORT void jl_coverage_visit_line(const char* filename_, size_t len_filename, int line)
1901+
{
1902+
StringRef filename = StringRef(filename_, len_filename);
1903+
if (imaging_mode || filename == "" || filename == "none" || filename == "no file" || filename == "<missing>" || line < 0)
1904+
return;
1905+
std::vector<logdata_block*> &vec = coverageData[filename];
1906+
uint64_t *ptr = allocLine(vec, line);
1907+
(*ptr)++;
1908+
}
1909+
19001910
// Memory allocation log (malloc_log)
19011911

19021912
static logdata_t mallocData;

0 commit comments

Comments
 (0)