1 //===-- xray_basic_flags.cpp ------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file is a part of XRay, a dynamic runtime instrumentation system.
11 // XRay Basic flag parsing logic.
12 //===----------------------------------------------------------------------===//
14 #include "xray_basic_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"
20 using namespace __sanitizer
;
24 /// Use via basicFlags().
25 BasicFlags xray_basic_flags_dont_use_directly
;
27 void BasicFlags::setDefaults() XRAY_NEVER_INSTRUMENT
{
28 #define XRAY_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue;
29 #include "xray_basic_flags.inc"
33 void registerXRayBasicFlags(FlagParser
*P
,
34 BasicFlags
*F
) XRAY_NEVER_INSTRUMENT
{
35 #define XRAY_FLAG(Type, Name, DefaultValue, Description) \
36 RegisterFlag(P, #Name, Description, &F->Name);
37 #include "xray_basic_flags.inc"
41 const char *useCompilerDefinedBasicFlags() XRAY_NEVER_INSTRUMENT
{
42 #ifdef XRAY_BASIC_OPTIONS
43 return SANITIZER_STRINGIFY(XRAY_BASIC_OPTIONS
);