ufe 7.0
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
CfgCoverageHelpers.h
Go to the documentation of this file.
1#line 1 "D:/Jenkins/workspace/EMS/ECG/ufe/full/ufe-full-python3.13-windows/ufe/gitmodules/peptide/src/config/CfgCoverageHelpers.h"
2//-
3// =============================================================================
4// Copyright 2025 Autodesk, Inc. All rights reserved.
5//
6// Use of this software is subject to the terms of the Autodesk license
7// agreement provided at the time of installation or download, or which
8// otherwise accompanies this software in either electronic or hard copy form.
9// =============================================================================
10//+
11
14
15#ifndef PEPTIDE_CFG_COVERAGE_HELPERS_H
16#define PEPTIDE_CFG_COVERAGE_HELPERS_H
17
18#include <cstdlib>
19
20// Define a function to flush current coverage results. This becomes vital in a
21// Maya environment which explicitly calls std::quick_exit() instead of exit()
22// and bypasses all atexit() callbacks, including those installed by GCOV or
23// LLVM to flush coverage buffers.
24
25#ifdef PEPTIDE_COVERAGE
26
27#ifdef PEPTIDE_COVERAGE_VIA_LCOV
28
29#if defined(__clang__)
30#pragma clang diagnostic push
31#pragma clang diagnostic ignored "-Wreserved-identifier"
32#endif
33
34extern "C" {
35#if defined(__clang__)
36// When compiling with Clang, GCC's gcov.h header cannot be found in the include paths even with --gcc-toolchain.
37void __gcov_dump (void);
38#else
39#include <gcov.h>
40#endif
41}
42
43// create a function local to the compilation unit
44static void peptide_flush_coverage() {
45 __gcov_dump();
46}
47
48struct PeptideCoverageFlusher {
49 PeptideCoverageFlusher() {
50 std::at_quick_exit(peptide_flush_coverage);
51 }
52};
53
54#if defined(__clang__)
55#pragma clang diagnostic pop
56#endif
57
58#else // PEPTIDE_COVERAGE_VIA_LLVM
59
60#if defined(__clang__)
61#pragma clang diagnostic push
62#pragma clang diagnostic ignored "-Wreserved-identifier"
63#endif
64
65// We do not have a header file on the LLVM side...
66extern "C" int __llvm_profile_write_file(void);
67
68// create a function local to the compilation unit
69static void peptide_flush_coverage() {
70 __llvm_profile_write_file();
71}
72
73struct PeptideCoverageFlusher {
74 PeptideCoverageFlusher() {
75 std::at_quick_exit(peptide_flush_coverage);
76 }
77};
78
79#if defined(__clang__)
80#pragma clang diagnostic pop
81#endif
82
83#endif // PEPTIDE_COVERAGE_VIA_LCOV
84
85#endif // PEPTIDE_COVERAGE
86
87#endif // PEPTIDE_CFG_COVERAGE_HELPERS_H