xref: /freebsd/contrib/llvm-project/compiler-rt/lib/xray/xray_profiling_flags.cpp (revision ec0ea6efa1ad229d75c394c1a9b9cac33af2b1d3)
1 //===-- xray_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 XRay, a dynamic runtime instrumentation system.
10 //
11 // XRay runtime flags.
12 //===----------------------------------------------------------------------===//
13 
14 #include "xray_profiling_flags.h"
15 #include "sanitizer_common/sanitizer_common.h"
16 #include "sanitizer_common/sanitizer_flag_parser.h"
17 #include "sanitizer_common/sanitizer_libc.h"
18 #include "xray_defs.h"
19 
20 namespace __xray {
21 
22 // Storage for the profiling flags.
23 ProfilerFlags xray_profiling_flags_dont_use_directly;
24 
25 void ProfilerFlags::setDefaults() XRAY_NEVER_INSTRUMENT {
26 #define XRAY_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue;
27 #include "xray_profiling_flags.inc"
28 #undef XRAY_FLAG
29 }
30 
31 void registerProfilerFlags(FlagParser *P,
32                            ProfilerFlags *F) XRAY_NEVER_INSTRUMENT {
33 #define XRAY_FLAG(Type, Name, DefaultValue, Description)                       \
34   RegisterFlag(P, #Name, Description, &F->Name);
35 #include "xray_profiling_flags.inc"
36 #undef XRAY_FLAG
37 }
38 
39 } // namespace __xray
40