clang-cl: missing code coverage when exception handling is enabled

Hi,
I'm trying to use gcov based code coverage analysis with clang-cl
targeting Windows.
Currently this won't work for functions where exceptions might be thrown:
https://reviews.llvm.org/D38223

Any pointers to what is needed to fix this? The approach discussed in
the linked review and related bug reports didn't seem to work out.

-Jan

What do you mean by “won’t work” - in the sense that a function that has exceptions enabled but no exception path is tested won’t have full coverage? That seems arguably correct/useful?

Currently functions that use exceptions are not instrumented at all. All
code in such functions shows up as '-' in the .gcov files.

For example: If you use std::string in a function and have exceptions
enabled with "/EHsc" this function won't be instrumented as std::string
might throw std::bad_alloc.

This is a pretty new feature though[1]. It works great for the Firefox
code base, but they have exceptions disabled I think.

[1]: https://marco-c.github.io/2018/01/09/code-coverage-with-clang-on-windows.html

Ah, I see - thanks for explaining! (I have no further context/don’t work on the Windows side of things - so will leave the rest of the thread to others who might have more relevant info)

I was discussing this general problem that instrumentation passes have with WinEH with Saleem and Shoaib last Friday. The fix is to extend the coverage pass to compute basic block colors and apply them to calls generated during coverage instrumentation.