1*b3018603SNico Weber //===-- xray_flags.h -------------------------------------------*- C++ -*-===//
2*b3018603SNico Weber //
3*b3018603SNico Weber // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*b3018603SNico Weber // See https://llvm.org/LICENSE.txt for license information.
5*b3018603SNico Weber // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*b3018603SNico Weber //
7*b3018603SNico Weber //===----------------------------------------------------------------------===//
8*b3018603SNico Weber //
9*b3018603SNico Weber // This file is a part of XRay, a dynamic runtime instrumentation system.
10*b3018603SNico Weber //
11*b3018603SNico Weber // XRay runtime flags.
12*b3018603SNico Weber //===----------------------------------------------------------------------===//
13*b3018603SNico Weber 
14*b3018603SNico Weber #include "xray_profiling_flags.h"
15*b3018603SNico Weber #include "sanitizer_common/sanitizer_common.h"
16*b3018603SNico Weber #include "sanitizer_common/sanitizer_flag_parser.h"
17*b3018603SNico Weber #include "sanitizer_common/sanitizer_libc.h"
18*b3018603SNico Weber #include "xray_defs.h"
19*b3018603SNico Weber 
20*b3018603SNico Weber namespace __xray {
21*b3018603SNico Weber 
22*b3018603SNico Weber // Storage for the profiling flags.
23*b3018603SNico Weber ProfilerFlags xray_profiling_flags_dont_use_directly;
24*b3018603SNico Weber 
setDefaults()25*b3018603SNico Weber void ProfilerFlags::setDefaults() XRAY_NEVER_INSTRUMENT {
26*b3018603SNico Weber #define XRAY_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue;
27*b3018603SNico Weber #include "xray_profiling_flags.inc"
28*b3018603SNico Weber #undef XRAY_FLAG
29*b3018603SNico Weber }
30*b3018603SNico Weber 
registerProfilerFlags(FlagParser * P,ProfilerFlags * F)31*b3018603SNico Weber void registerProfilerFlags(FlagParser *P,
32*b3018603SNico Weber                            ProfilerFlags *F) XRAY_NEVER_INSTRUMENT {
33*b3018603SNico Weber #define XRAY_FLAG(Type, Name, DefaultValue, Description)                       \
34*b3018603SNico Weber   RegisterFlag(P, #Name, Description, &F->Name);
35*b3018603SNico Weber #include "xray_profiling_flags.inc"
36*b3018603SNico Weber #undef XRAY_FLAG
37*b3018603SNico Weber }
38*b3018603SNico Weber 
39*b3018603SNico Weber } // namespace __xray
40