48 lines · c
1//===-- memprof_flags.h ---------------------------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9// This file is a part of MemProfiler, a memory profiler.10//11// MemProf runtime flags.12//===----------------------------------------------------------------------===//13 14#ifndef MEMPROF_FLAGS_H15#define MEMPROF_FLAGS_H16 17#include "sanitizer_common/sanitizer_flag_parser.h"18#include "sanitizer_common/sanitizer_internal_defs.h"19 20// Default MemProf flags are defined in memprof_flags.inc and sancov_flags.inc.21// These values can be overridden in a number of ways, each option overrides the22// prior one:23// 1) by setting MEMPROF_DEFAULT_OPTIONS during the compilation of the MemProf24// runtime25// 2) by setting the LLVM flag -memprof-runtime-default-options during the26// compilation of your binary27// 3) by overriding the user-specified function __memprof_default_options()28// 4) by setting the environment variable MEMPROF_OPTIONS during runtime29 30namespace __memprof {31 32struct Flags {33#define MEMPROF_FLAG(Type, Name, DefaultValue, Description) Type Name;34#include "memprof_flags.inc"35#undef MEMPROF_FLAG36 37 void SetDefaults();38};39 40extern Flags memprof_flags_dont_use_directly;41inline Flags *flags() { return &memprof_flags_dont_use_directly; }42 43void InitializeFlags();44 45} // namespace __memprof46 47#endif // MEMPROF_FLAGS_H48