mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 08:36:07 +00:00

Add the `__memprof_default_options_str` variable, initialized via the `-memprof-runtime-default-options` LLVM flag, to hold the default options string for memprof. This allows us to set these options during compile time in the clang invocation. Also update the docs to describe the various ways to set these options.
48 lines
1.6 KiB
C++
48 lines
1.6 KiB
C++
//===-- 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 overridded 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
|