Fix date
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_flags.h
blobff64af10ff5ae8e1e16fd7a7367e7e5acff14436
1 //===-- sanitizer_flags.h ---------------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is a part of ThreadSanitizer/AddressSanitizer runtime.
9 //
10 //===----------------------------------------------------------------------===//
12 #ifndef SANITIZER_FLAGS_H
13 #define SANITIZER_FLAGS_H
15 #include "sanitizer_internal_defs.h"
17 namespace __sanitizer {
19 struct CommonFlags {
20 #define COMMON_FLAG(Type, Name, DefaultValue, Description) Type Name;
21 #include "sanitizer_flags.inc"
22 #undef COMMON_FLAG
24 void SetDefaults();
25 void CopyFrom(const CommonFlags &other);
28 // Functions to get/set global CommonFlags shared by all sanitizer runtimes:
29 extern CommonFlags common_flags_dont_use;
30 inline const CommonFlags *common_flags() {
31 return &common_flags_dont_use;
34 inline void SetCommonFlagsDefaults() {
35 common_flags_dont_use.SetDefaults();
38 // This function can only be used to setup tool-specific overrides for
39 // CommonFlags defaults. Generally, it should only be used right after
40 // SetCommonFlagsDefaults(), but before ParseCommonFlagsFromString(), and
41 // only during the flags initialization (i.e. before they are used for
42 // the first time).
43 inline void OverrideCommonFlags(const CommonFlags &cf) {
44 common_flags_dont_use.CopyFrom(cf);
47 void SubstituteForFlagValue(const char *s, char *out, uptr out_size);
49 class FlagParser;
50 void RegisterCommonFlags(FlagParser *parser,
51 CommonFlags *cf = &common_flags_dont_use);
52 void RegisterIncludeFlags(FlagParser *parser, CommonFlags *cf);
54 // Should be called after parsing all flags. Sets up common flag values
55 // and perform initializations common to all sanitizers (e.g. setting
56 // verbosity).
57 void InitializeCommonFlags(CommonFlags *cf = &common_flags_dont_use);
58 } // namespace __sanitizer
60 #endif // SANITIZER_FLAGS_H