1 //===-- sanitizer_flags.h ---------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file is a part of ThreadSanitizer/AddressSanitizer runtime.
12 //===----------------------------------------------------------------------===//
14 #ifndef SANITIZER_FLAGS_H
15 #define SANITIZER_FLAGS_H
17 #include "sanitizer_internal_defs.h"
19 namespace __sanitizer {
22 #define COMMON_FLAG(Type, Name, DefaultValue, Description) Type Name;
23 #include "sanitizer_flags.inc"
27 void CopyFrom(const CommonFlags &other);
30 // Functions to get/set global CommonFlags shared by all sanitizer runtimes:
31 extern CommonFlags common_flags_dont_use;
32 inline const CommonFlags *common_flags() {
33 return &common_flags_dont_use;
36 inline void SetCommonFlagsDefaults() {
37 common_flags_dont_use.SetDefaults();
40 // This function can only be used to setup tool-specific overrides for
41 // CommonFlags defaults. Generally, it should only be used right after
42 // SetCommonFlagsDefaults(), but before ParseCommonFlagsFromString(), and
43 // only during the flags initialization (i.e. before they are used for
45 inline void OverrideCommonFlags(const CommonFlags &cf) {
46 common_flags_dont_use.CopyFrom(cf);
49 void SubstituteForFlagValue(const char *s, char *out, uptr out_size);
52 void RegisterCommonFlags(FlagParser *parser,
53 CommonFlags *cf = &common_flags_dont_use);
54 void RegisterIncludeFlags(FlagParser *parser, CommonFlags *cf);
56 // Should be called after parsing all flags. Sets up common flag values
57 // and perform initializations common to all sanitizers (e.g. setting
59 void InitializeCommonFlags(CommonFlags *cf = &common_flags_dont_use);
60 } // namespace __sanitizer
62 #endif // SANITIZER_FLAGS_H