1 //===-- sanitizer_flags.h ---------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file is a part of ThreadSanitizer/AddressSanitizer runtime.
11 //===----------------------------------------------------------------------===//
13 #ifndef SANITIZER_FLAGS_H
14 #define SANITIZER_FLAGS_H
16 #include "sanitizer_internal_defs.h"
18 namespace __sanitizer {
20 enum HandleSignalMode {
23 kHandleSignalExclusive,
27 #define COMMON_FLAG(Type, Name, DefaultValue, Description) Type Name;
28 #include "sanitizer_flags.inc"
32 void CopyFrom(const CommonFlags &other);
35 // Functions to get/set global CommonFlags shared by all sanitizer runtimes:
36 extern CommonFlags common_flags_dont_use;
37 inline const CommonFlags *common_flags() {
38 return &common_flags_dont_use;
41 inline void SetCommonFlagsDefaults() {
42 common_flags_dont_use.SetDefaults();
45 // This function can only be used to setup tool-specific overrides for
46 // CommonFlags defaults. Generally, it should only be used right after
47 // SetCommonFlagsDefaults(), but before ParseCommonFlagsFromString(), and
48 // only during the flags initialization (i.e. before they are used for
50 inline void OverrideCommonFlags(const CommonFlags &cf) {
51 common_flags_dont_use.CopyFrom(cf);
54 void SubstituteForFlagValue(const char *s, char *out, uptr out_size);
57 void RegisterCommonFlags(FlagParser *parser,
58 CommonFlags *cf = &common_flags_dont_use);
59 void RegisterIncludeFlags(FlagParser *parser, CommonFlags *cf);
61 // Should be called after parsing all flags. Sets up common flag values
62 // and perform initializations common to all sanitizers (e.g. setting
64 void InitializeCommonFlags(CommonFlags *cf = &common_flags_dont_use);
65 } // namespace __sanitizer
67 #endif // SANITIZER_FLAGS_H