[flang][cuda] Adapt ExternalNameConversion to work in gpu module (#117039)
[llvm-project.git] / compiler-rt / lib / sanitizer_common / sanitizer_flags.h
blob5b59e5801bf9130f56b9c57e96171fa5c5a9e1d4
1 //===-- sanitizer_flags.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 //
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 {
21 kHandleSignalNo,
22 kHandleSignalYes,
23 kHandleSignalExclusive,
26 struct CommonFlags {
27 #define COMMON_FLAG(Type, Name, DefaultValue, Description) Type Name;
28 #include "sanitizer_flags.inc"
29 #undef COMMON_FLAG
31 void SetDefaults();
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
49 // the first time).
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);
56 class FlagParser;
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
63 // verbosity).
64 void InitializeCommonFlags(CommonFlags *cf = &common_flags_dont_use);
66 // Platform specific flags initialization.
67 void InitializePlatformCommonFlags(CommonFlags *cf);
69 } // namespace __sanitizer
71 #endif // SANITIZER_FLAGS_H