/ src / test / util / coverage.cpp
coverage.cpp
 1  // Copyright (c) 2025-present The Bitcoin Core developers
 2  // Distributed under the MIT software license, see the accompanying
 3  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
 4  
 5  #include <test/util/coverage.h>
 6  
 7  #if defined(__clang__)
 8  extern "C" __attribute__((weak)) void __llvm_profile_reset_counters(void);
 9  extern "C" __attribute__((weak)) void __gcov_reset(void);
10  
11  // Fallback implementations
12  extern "C" __attribute__((weak)) void __llvm_profile_reset_counters(void) {}
13  extern "C" __attribute__((weak)) void __gcov_reset(void) {}
14  
15  void ResetCoverageCounters() {
16      // These will call the real ones if available, or our dummies if not
17      __llvm_profile_reset_counters();
18      __gcov_reset();
19  }
20  #else
21  void ResetCoverageCounters() {}
22  #endif