1 | #include <common/coverage.h> |
2 | #include <common/config_common.h> |
3 | |
4 | #if WITH_COVERAGE |
5 | |
6 | #include <unistd.h> |
7 | #include <mutex> |
8 | |
9 | #if defined(__clang__) |
10 | extern "C" void __llvm_profile_dump(); |
11 | #elif defined(__GNUC__) || defined(__GNUG__) |
12 | extern "C" void __gcov_exit(); |
13 | #endif |
14 | |
15 | #endif |
16 | |
17 | |
18 | void dumpCoverageReportIfPossible() |
19 | { |
20 | #if WITH_COVERAGE |
21 | static std::mutex mutex; |
22 | std::lock_guard lock(mutex); |
23 | |
24 | #if defined(__clang__) |
25 | __llvm_profile_dump(); |
26 | #elif defined(__GNUC__) || defined(__GNUG__) |
27 | __gcov_exit(); |
28 | #endif |
29 | |
30 | #endif |
31 | } |
32 | |