Mitch Phillips | 0dcf999 | 2019-06-04 17:01:11 +0000 | [diff] [blame] | 1 | //===-- options_parser.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 | #ifndef GWP_ASAN_OPTIONAL_OPTIONS_PARSER_H_ |
| 10 | #define GWP_ASAN_OPTIONAL_OPTIONS_PARSER_H_ |
| 11 | |
Mitch Phillips | 77c28f9 | 2021-01-15 12:57:00 -0800 | [diff] [blame] | 12 | #include "gwp_asan/optional/printf.h" |
Mitch Phillips | 0dcf999 | 2019-06-04 17:01:11 +0000 | [diff] [blame] | 13 | #include "gwp_asan/options.h" |
Mitch Phillips | 0dcf999 | 2019-06-04 17:01:11 +0000 | [diff] [blame] | 14 | |
| 15 | namespace gwp_asan { |
| 16 | namespace options { |
Mitch Phillips | 77c28f9 | 2021-01-15 12:57:00 -0800 | [diff] [blame] | 17 | // Parse the options from the GWP_ASAN_OPTIONS environment variable. |
| 18 | void initOptions(Printf_t PrintfForWarnings = nullptr); |
| 19 | // Parse the options from the provided string. |
| 20 | void initOptions(const char *OptionsStr, Printf_t PrintfForWarnings = nullptr); |
Mitch Phillips | 2685724 | 2019-07-02 16:04:52 +0000 | [diff] [blame] | 21 | // Returns the initialised options. Call initOptions() prior to calling this |
| 22 | // function. |
| 23 | Options &getOptions(); |
Mitch Phillips | 0dcf999 | 2019-06-04 17:01:11 +0000 | [diff] [blame] | 24 | } // namespace options |
| 25 | } // namespace gwp_asan |
| 26 | |
| 27 | extern "C" { |
Mitch Phillips | 77c28f9 | 2021-01-15 12:57:00 -0800 | [diff] [blame] | 28 | __attribute__((weak)) const char *__gwp_asan_default_options(); |
Mitch Phillips | 0dcf999 | 2019-06-04 17:01:11 +0000 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | #endif // GWP_ASAN_OPTIONAL_OPTIONS_PARSER_H_ |