14#include "llvm/ADT/Hashing.h"
15#include "llvm/ADT/SmallVector.h"
16#include "llvm/ADT/StringSwitch.h"
17#include "llvm/Support/MathExtras.h"
23#define SANITIZER(NAME, ID) constexpr SanitizerMask SanitizerKind::ID;
24#define SANITIZER_GROUP(NAME, ID, ALIAS) \
25 constexpr SanitizerMask SanitizerKind::ID; \
26 constexpr SanitizerMask SanitizerKind::ID##Group;
27#include "clang/Basic/Sanitizers.def"
31#define SANITIZER(NAME, ID) .Case(NAME, SanitizerKind::ID)
32#define SANITIZER_GROUP(NAME, ID, ALIAS) \
33 .Case(NAME, AllowGroups ? SanitizerKind::ID##Group : SanitizerMask())
34#include "clang/Basic/Sanitizers.def"
41#define SANITIZER(NAME, ID) \
42 if (Set.has(SanitizerKind::ID)) \
43 Values.push_back(NAME);
44#include "clang/Basic/Sanitizers.def"
48#define SANITIZER(NAME, ID)
49#define SANITIZER_GROUP(NAME, ID, ALIAS) \
50 if (Kinds & SanitizerKind::ID##Group) \
51 Kinds |= SanitizerKind::ID;
52#include "clang/Basic/Sanitizers.def"
57 return llvm::hash_combine_range(&maskLoToHigh[0], &maskLoToHigh[kNumElem]);
63 for (
const auto &Val : maskLoToHigh)
64 total += llvm::popcount(Val);
74 case llvm::AsanDtorKind::None:
76 case llvm::AsanDtorKind::Global:
78 case llvm::AsanDtorKind::Invalid:
85 return llvm::StringSwitch<llvm::AsanDtorKind>(kindStr)
86 .Case(
"none", llvm::AsanDtorKind::None)
87 .Case(
"global", llvm::AsanDtorKind::Global)
88 .Default(llvm::AsanDtorKind::Invalid);
92 llvm::AsanDetectStackUseAfterReturnMode mode) {
94 case llvm::AsanDetectStackUseAfterReturnMode::Always:
96 case llvm::AsanDetectStackUseAfterReturnMode::Runtime:
98 case llvm::AsanDetectStackUseAfterReturnMode::Never:
100 case llvm::AsanDetectStackUseAfterReturnMode::Invalid:
106llvm::AsanDetectStackUseAfterReturnMode
108 return llvm::StringSwitch<llvm::AsanDetectStackUseAfterReturnMode>(modeStr)
109 .Case(
"always", llvm::AsanDetectStackUseAfterReturnMode::Always)
110 .Case(
"runtime", llvm::AsanDetectStackUseAfterReturnMode::Runtime)
111 .Case(
"never", llvm::AsanDetectStackUseAfterReturnMode::Never)
112 .Default(llvm::AsanDetectStackUseAfterReturnMode::Invalid);
Defines the clang::SanitizerKind enum.
llvm::hash_code hash_value() const
unsigned countPopulation() const
The JSON file list parser is used to communicate input to InstallAPI.
StringRef AsanDtorKindToString(llvm::AsanDtorKind kind)
void serializeSanitizerSet(SanitizerSet Set, SmallVectorImpl< StringRef > &Values)
Serialize a SanitizerSet into values for -fsanitize= or -fno-sanitize=.
SanitizerMask expandSanitizerGroups(SanitizerMask Kinds)
For each sanitizer group bit set in Kinds, set the bits for sanitizers this group enables.
SanitizerMask parseSanitizerValue(StringRef Value, bool AllowGroups)
Parse a single value from a -fsanitize= or -fno-sanitize= value list.
llvm::hash_code hash_value(const CustomizableOptional< T > &O)
llvm::AsanDtorKind AsanDtorKindFromString(StringRef kind)
llvm::AsanDetectStackUseAfterReturnMode AsanDetectStackUseAfterReturnModeFromString(StringRef modeStr)
StringRef AsanDetectStackUseAfterReturnModeToString(llvm::AsanDetectStackUseAfterReturnMode mode)