17#include "llvm/ADT/StringRef.h"
18#include "llvm/IR/Constants.h"
21using namespace CodeGen;
26 return SS.
hasOneOf(SanitizerKind::Address | SanitizerKind::KernelAddress |
27 SanitizerKind::HWAddress | SanitizerKind::MemTag);
31 if (Mask & (SanitizerKind::Address | SanitizerKind::KernelAddress))
32 Mask |= SanitizerKind::Address | SanitizerKind::KernelAddress;
49 FsanitizeArgument.
Mask};
51 llvm::GlobalVariable::SanitizerMetadata Meta;
52 if (GV->hasSanitizerMetadata())
53 Meta = GV->getSanitizerMetadata();
55 Meta.NoAddress |= NoSanitizeAttrSet.
hasOneOf(SanitizerKind::Address);
57 FsanitizeArgument.
Mask & SanitizerKind::Address, GV,
Loc, Ty);
59 Meta.NoHWAddress |= NoSanitizeAttrSet.
hasOneOf(SanitizerKind::HWAddress);
61 FsanitizeArgument.
Mask & SanitizerKind::HWAddress, GV,
Loc, Ty);
64 static_cast<bool>(FsanitizeArgument.
Mask & SanitizerKind::MemtagGlobals);
65 Meta.Memtag &= !NoSanitizeAttrSet.
hasOneOf(SanitizerKind::MemTag);
67 FsanitizeArgument.
Mask & SanitizerKind::MemTag, GV,
Loc, Ty);
69 Meta.IsDynInit = IsDynInit && !Meta.NoAddress &&
70 FsanitizeArgument.
has(SanitizerKind::Address) &&
72 SanitizerKind::KernelAddress,
75 GV->setSanitizerMetadata(Meta);
83 llvm::raw_string_ostream OS(QualName);
84 D.printQualifiedName(OS);
86 auto getNoSanitizeMask = [](
const VarDecl &
D) {
87 if (
D.
hasAttr<DisableSanitizerInstrumentationAttr>())
88 return SanitizerKind::All;
92 NoSanitizeMask |=
Attr->getMask();
94 return NoSanitizeMask;
Defines the SourceManager interface.
C Language Family Type Representation.
Attr - This represents one attribute.
This class organizes the cross-function state that is used while generating LLVM code.
bool isInNoSanitizeList(SanitizerMask Kind, llvm::Function *Fn, SourceLocation Loc) const
const LangOptions & getLangOpts() const
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
SourceLocation getLocation() const
SanitizerSet Sanitize
Set of enabled sanitizers.
A (possibly-)qualified type.
Encodes a location in the source.
Represents a variable declaration or definition.
The JSON file list parser is used to communicate input to InstallAPI.
bool has(SanitizerMask K) const
Check if a certain (single) sanitizer is enabled.
SanitizerMask Mask
Bitmask of enabled sanitizers.
bool hasOneOf(SanitizerMask K) const
Check if one or more sanitizers are enabled.