xref: /freebsd/contrib/llvm-project/compiler-rt/lib/memprof/memprof_flags.h (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file is a part of MemProfiler, a memory profiler.
10 //
11 // MemProf runtime flags.
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef MEMPROF_FLAGS_H
15 #define MEMPROF_FLAGS_H
16 
17 #include "sanitizer_common/sanitizer_flag_parser.h"
18 #include "sanitizer_common/sanitizer_internal_defs.h"
19 
20 // MemProf flag values can be defined in four ways:
21 // 1) initialized with default values at startup.
22 // 2) overriden during compilation of MemProf runtime by providing
23 //    compile definition MEMPROF_DEFAULT_OPTIONS.
24 // 3) overriden from string returned by user-specified function
25 //    __memprof_default_options().
26 // 4) overriden from env variable MEMPROF_OPTIONS.
27 
28 namespace __memprof {
29 
30 struct Flags {
31 #define MEMPROF_FLAG(Type, Name, DefaultValue, Description) Type Name;
32 #include "memprof_flags.inc"
33 #undef MEMPROF_FLAG
34 
35   void SetDefaults();
36 };
37 
38 extern Flags memprof_flags_dont_use_directly;
flags()39 inline Flags *flags() { return &memprof_flags_dont_use_directly; }
40 
41 void InitializeFlags();
42 
43 } // namespace __memprof
44 
45 #endif // MEMPROF_FLAGS_H
46