aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt/lib/memprof/memprof_flags.h
blob: 72701d14fbd8da9f24cbfcc3948d989a2771cec9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//===-- memprof_flags.h ---------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file is a part of MemProfiler, a memory profiler.
//
// MemProf runtime flags.
//===----------------------------------------------------------------------===//

#ifndef MEMPROF_FLAGS_H
#define MEMPROF_FLAGS_H

#include "sanitizer_common/sanitizer_flag_parser.h"
#include "sanitizer_common/sanitizer_internal_defs.h"

// Default MemProf flags are defined in memprof_flags.inc and sancov_flags.inc.
// These values can be overridden in a number of ways, each option overrides the
// prior one:
//  1) by setting MEMPROF_DEFAULT_OPTIONS during the compilation of the MemProf
//     runtime
//  2) by setting the LLVM flag -memprof-runtime-default-options during the
//     compilation of your binary
//  3) by overriding the user-specified function __memprof_default_options()
//  4) by setting the environment variable MEMPROF_OPTIONS during runtime

namespace __memprof {

struct Flags {
#define MEMPROF_FLAG(Type, Name, DefaultValue, Description) Type Name;
#include "memprof_flags.inc"
#undef MEMPROF_FLAG

  void SetDefaults();
};

extern Flags memprof_flags_dont_use_directly;
inline Flags *flags() { return &memprof_flags_dont_use_directly; }

void InitializeFlags();

} // namespace __memprof

#endif // MEMPROF_FLAGS_H