options_parser.h 1.1 KB

12345678910111213141516171819202122232425262728293031
  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. #ifndef GWP_ASAN_OPTIONAL_OPTIONS_PARSER_H_
  9. #define GWP_ASAN_OPTIONAL_OPTIONS_PARSER_H_
  10. #include "gwp_asan/optional/printf.h"
  11. #include "gwp_asan/options.h"
  12. namespace gwp_asan {
  13. namespace options {
  14. // Parse the options from the GWP_ASAN_OPTIONS environment variable.
  15. void initOptions(Printf_t PrintfForWarnings = nullptr);
  16. // Parse the options from the provided string.
  17. void initOptions(const char *OptionsStr, Printf_t PrintfForWarnings = nullptr);
  18. // Returns the initialised options. Call initOptions() prior to calling this
  19. // function.
  20. Options &getOptions();
  21. } // namespace options
  22. } // namespace gwp_asan
  23. extern "C" {
  24. __attribute__((weak)) const char *__gwp_asan_default_options();
  25. }
  26. #endif // GWP_ASAN_OPTIONAL_OPTIONS_PARSER_H_