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 // 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 the 22 // prior one: 23 // 1) by setting MEMPROF_DEFAULT_OPTIONS during the compilation of the MemProf 24 // runtime 25 // 2) by setting the LLVM flag -memprof-runtime-default-options during the 26 // compilation of your binary 27 // 3) by overriding the user-specified function __memprof_default_options() 28 // 4) by setting the environment variable MEMPROF_OPTIONS during runtime 29 30 namespace __memprof { 31 32 struct Flags { 33 #define MEMPROF_FLAG(Type, Name, DefaultValue, Description) Type Name; 34 #include "memprof_flags.inc" 35 #undef MEMPROF_FLAG 36 37 void SetDefaults(); 38 }; 39 40 extern Flags memprof_flags_dont_use_directly; flags()41inline Flags *flags() { return &memprof_flags_dont_use_directly; } 42 43 void InitializeFlags(); 44 45 } // namespace __memprof 46 47 #endif // MEMPROF_FLAGS_H 48