#if !defined(__Fuchsia__)
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "WindowsMMap.h"
#else
#include <sys/file.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <unistd.h>
#endif
#include "InstrProfiling.h"
#include "InstrProfilingUtil.h"
enum { … };
static char *filename = …;
static FILE *output_file = …;
#define WRITE_BUFFER_SIZE …
static unsigned char *write_buffer = …;
static uint64_t cur_buffer_size = …;
static uint64_t cur_pos = …;
static uint64_t file_size = …;
static int new_file = …;
static int gcov_version;
#if defined(_WIN32)
static HANDLE mmap_handle = NULL;
#endif
static int fd = …;
fn_ptr;
dynamic_object_id;
static dynamic_object_id current_id;
#define CURRENT_ID …
struct fn_node { … };
struct fn_list { … };
struct fn_list writeout_fn_list;
struct fn_list reset_fn_list;
static void fn_list_insert(struct fn_list* list, fn_ptr fn) { … }
static void fn_list_remove(struct fn_list* list) { … }
static void resize_write_buffer(uint64_t size) { … }
static void write_bytes(const char *s, size_t len) { … }
static void write_32bit_value(uint32_t i) { … }
static void write_64bit_value(uint64_t i) { … }
static uint32_t read_32bit_value(void) { … }
static uint64_t read_64bit_value(void) { … }
static char *mangle_filename(const char *orig_filename) { … }
static int map_file(void) { … }
static void unmap_file(void) { … }
COMPILER_RT_VISIBILITY
void llvm_gcda_start_file(const char *orig_filename, uint32_t version,
uint32_t checksum) { … }
COMPILER_RT_VISIBILITY
void llvm_gcda_emit_function(uint32_t ident, uint32_t func_checksum,
uint32_t cfg_checksum) { … }
COMPILER_RT_VISIBILITY
void llvm_gcda_emit_arcs(uint32_t num_counters, uint64_t *counters) { … }
COMPILER_RT_VISIBILITY
void llvm_gcda_summary_info(void) { … }
COMPILER_RT_VISIBILITY
void llvm_gcda_end_file(void) { … }
COMPILER_RT_VISIBILITY
void llvm_register_writeout_function(fn_ptr fn) { … }
COMPILER_RT_VISIBILITY
void llvm_writeout_files(void) { … }
#ifndef _WIN32
#if __GNUC__ >= 9
#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
#endif
__attribute__((destructor(100)))
#endif
static void llvm_writeout_and_clear(void) { … }
COMPILER_RT_VISIBILITY
void llvm_register_reset_function(fn_ptr fn) { … }
COMPILER_RT_VISIBILITY
void llvm_delete_reset_function_list(void) { … }
COMPILER_RT_VISIBILITY
void llvm_reset_counters(void) { … }
#if !defined(_WIN32)
COMPILER_RT_VISIBILITY
pid_t __gcov_fork() { … }
#endif
COMPILER_RT_VISIBILITY
void llvm_gcov_init(fn_ptr wfn, fn_ptr rfn) { … }
void __gcov_dump(void) { … }
void __gcov_reset(void) { … }
#endif