19f666ea6SAlexey Samsonov //===-- asan_flags.h -------------------------------------------*- C++ -*-===// 29f666ea6SAlexey Samsonov // 3*2946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*2946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 5*2946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 69f666ea6SAlexey Samsonov // 79f666ea6SAlexey Samsonov //===----------------------------------------------------------------------===// 89f666ea6SAlexey Samsonov // 99f666ea6SAlexey Samsonov // This file is a part of AddressSanitizer, an address sanity checker. 109f666ea6SAlexey Samsonov // 119f666ea6SAlexey Samsonov // ASan runtime flags. 129f666ea6SAlexey Samsonov //===----------------------------------------------------------------------===// 139f666ea6SAlexey Samsonov 149f666ea6SAlexey Samsonov #ifndef ASAN_FLAGS_H 159f666ea6SAlexey Samsonov #define ASAN_FLAGS_H 169f666ea6SAlexey Samsonov 1735869827SEvgeniy Stepanov #include "sanitizer_common/sanitizer_internal_defs.h" 18f294d5b8SEvgeniy Stepanov #include "sanitizer_common/sanitizer_flag_parser.h" 199f666ea6SAlexey Samsonov 200b07c63eSAlexey Samsonov // ASan flag values can be defined in four ways: 219f666ea6SAlexey Samsonov // 1) initialized with default values at startup. 220b07c63eSAlexey Samsonov // 2) overriden during compilation of ASan runtime by providing 230b07c63eSAlexey Samsonov // compile definition ASAN_DEFAULT_OPTIONS. 240b07c63eSAlexey Samsonov // 3) overriden from string returned by user-specified function 25c145b026SAlexey Samsonov // __asan_default_options(). 260b07c63eSAlexey Samsonov // 4) overriden from env variable ASAN_OPTIONS. 2703499e92SAlexey Samsonov // 5) overriden during ASan activation (for now used on Android only). 289f666ea6SAlexey Samsonov 299f666ea6SAlexey Samsonov namespace __asan { 309f666ea6SAlexey Samsonov 319f666ea6SAlexey Samsonov struct Flags { 3203499e92SAlexey Samsonov #define ASAN_FLAG(Type, Name, DefaultValue, Description) Type Name; 3303499e92SAlexey Samsonov #include "asan_flags.inc" 3403499e92SAlexey Samsonov #undef ASAN_FLAG 3503499e92SAlexey Samsonov 3603499e92SAlexey Samsonov void SetDefaults(); 379f666ea6SAlexey Samsonov }; 389bac1cedSAlexander Potapenko 39fd27b83eSKostya Serebryany extern Flags asan_flags_dont_use_directly; flags()40fd27b83eSKostya Serebryanyinline Flags *flags() { 41fd27b83eSKostya Serebryany return &asan_flags_dont_use_directly; 42fd27b83eSKostya Serebryany } 431225816aSAlexey Samsonov 441225816aSAlexey Samsonov void InitializeFlags(); 459f666ea6SAlexey Samsonov 469f666ea6SAlexey Samsonov } // namespace __asan 479f666ea6SAlexey Samsonov 489f666ea6SAlexey Samsonov #endif // ASAN_FLAGS_H 49