]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/lib/sanitizer_common/sanitizer_flags.h
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / compiler-rt / lib / sanitizer_common / sanitizer_flags.h
CommitLineData
1a4d82fc
JJ
1//===-- sanitizer_flags.h ---------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file is a part of ThreadSanitizer/AddressSanitizer runtime.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef SANITIZER_FLAGS_H
15#define SANITIZER_FLAGS_H
16
17#include "sanitizer_internal_defs.h"
18
19namespace __sanitizer {
20
1a4d82fc 21struct CommonFlags {
92a42be0
SL
22#define COMMON_FLAG(Type, Name, DefaultValue, Description) Type Name;
23#include "sanitizer_flags.inc"
24#undef COMMON_FLAG
25
26 void SetDefaults();
27 void CopyFrom(const CommonFlags &other);
1a4d82fc
JJ
28};
29
92a42be0
SL
30// Functions to get/set global CommonFlags shared by all sanitizer runtimes:
31extern CommonFlags common_flags_dont_use;
32inline const CommonFlags *common_flags() {
1a4d82fc
JJ
33 return &common_flags_dont_use;
34}
35
92a42be0
SL
36inline void SetCommonFlagsDefaults() {
37 common_flags_dont_use.SetDefaults();
38}
39
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
44// the first time).
45inline void OverrideCommonFlags(const CommonFlags &cf) {
46 common_flags_dont_use.CopyFrom(cf);
47}
1a4d82fc 48
92a42be0
SL
49class FlagParser;
50void RegisterCommonFlags(FlagParser *parser,
51 CommonFlags *cf = &common_flags_dont_use);
52void RegisterIncludeFlags(FlagParser *parser, CommonFlags *cf);
1a4d82fc
JJ
53} // namespace __sanitizer
54
55#endif // SANITIZER_FLAGS_H