1 //===-- asan_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 AddressSanitizer, an address sanity checker.
10 //
11 // ASan runtime flags.
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef ASAN_FLAGS_H
15 #define ASAN_FLAGS_H
16 
17 #include "sanitizer_common/sanitizer_internal_defs.h"
18 #include "sanitizer_common/sanitizer_flag_parser.h"
19 
20 // ASan flag values can be defined in four ways:
21 // 1) initialized with default values at startup.
22 // 2) overriden during compilation of ASan runtime by providing
23 //    compile definition ASAN_DEFAULT_OPTIONS.
24 // 3) overriden from string returned by user-specified function
25 //    __asan_default_options().
26 // 4) overriden from env variable ASAN_OPTIONS.
27 // 5) overriden during ASan activation (for now used on Android only).
28 
29 namespace __asan {
30 
31 struct Flags {
32 #define ASAN_FLAG(Type, Name, DefaultValue, Description) Type Name;
33 #include "asan_flags.inc"
34 #undef ASAN_FLAG
35 
36   void SetDefaults();
37 };
38 
39 extern Flags asan_flags_dont_use_directly;
40 inline Flags *flags() {
41   return &asan_flags_dont_use_directly;
42 }
43 
44 void InitializeFlags();
45 
46 }  // namespace __asan
47 
48 #endif  // ASAN_FLAGS_H
49