Dean Michael Berris | 47e6b8c | 2018-05-04 06:27:53 +0000 | [diff] [blame] | 1 | //===-- xray_basic_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 Basic flag parsing logic. |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #include "xray_basic_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 | /// Use via basicFlags(). |
| 26 | BasicFlags xray_basic_flags_dont_use_directly; |
| 27 | |
| 28 | void BasicFlags::setDefaults() XRAY_NEVER_INSTRUMENT { |
| 29 | #define XRAY_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue; |
| 30 | #include "xray_basic_flags.inc" |
| 31 | #undef XRAY_FLAG |
| 32 | } |
| 33 | |
| 34 | void registerXRayBasicFlags(FlagParser *P, |
| 35 | BasicFlags *F) XRAY_NEVER_INSTRUMENT { |
| 36 | #define XRAY_FLAG(Type, Name, DefaultValue, Description) \ |
| 37 | RegisterFlag(P, #Name, Description, &F->Name); |
| 38 | #include "xray_basic_flags.inc" |
| 39 | #undef XRAY_FLAG |
| 40 | } |
| 41 | |
| 42 | const char *useCompilerDefinedBasicFlags() XRAY_NEVER_INSTRUMENT { |
| 43 | #ifdef XRAY_BASIC_OPTIONS |
| 44 | return SANITIZER_STRINGIFY(XRAY_BASIC_OPTIONS); |
| 45 | #else |
| 46 | return ""; |
| 47 | #endif |
| 48 | } |
| 49 | |
| 50 | } // namespace __xray |