Home | History | Annotate | Line # | Download | only in xray
      1 //===-- xray_fdr_flags.cc ---------------------------------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file is a part of XRay, a dynamic runtime instrumentation system.
     11 //
     12 // XRay FDR flag parsing logic.
     13 //===----------------------------------------------------------------------===//
     14 
     15 #include "xray_fdr_flags.h"
     16 #include "sanitizer_common/sanitizer_common.h"
     17 #include "sanitizer_common/sanitizer_flag_parser.h"
     18 #include "sanitizer_common/sanitizer_libc.h"
     19 #include "xray_defs.h"
     20 
     21 using namespace __sanitizer;
     22 
     23 namespace __xray {
     24 
     25 FDRFlags xray_fdr_flags_dont_use_directly; // use via fdrFlags().
     26 
     27 void FDRFlags::setDefaults() XRAY_NEVER_INSTRUMENT {
     28 #define XRAY_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue;
     29 #include "xray_fdr_flags.inc"
     30 #undef XRAY_FLAG
     31 }
     32 
     33 void registerXRayFDRFlags(FlagParser *P, FDRFlags *F) XRAY_NEVER_INSTRUMENT {
     34 #define XRAY_FLAG(Type, Name, DefaultValue, Description)                       \
     35   RegisterFlag(P, #Name, Description, &F->Name);
     36 #include "xray_fdr_flags.inc"
     37 #undef XRAY_FLAG
     38 }
     39 
     40 const char *useCompilerDefinedFDRFlags() XRAY_NEVER_INSTRUMENT {
     41 #ifdef XRAY_FDR_OPTIONS
     42   return SANITIZER_STRINGIFY(XRAY_FDR_OPTIONS);
     43 #else
     44   return "";
     45 #endif
     46 }
     47 
     48 } // namespace __xray
     49