forked from OSchip/llvm-project
parent
53fe155b3f
commit
f49a5844b6
|
@ -473,7 +473,7 @@ void CodeGenFunction::EmitStaticVarDecl(const VarDecl &D,
|
|||
LocalDeclMap.find(&D)->second = Address(castedAddr, elemTy, alignment);
|
||||
CGM.setStaticLocalDeclAddress(&D, castedAddr);
|
||||
|
||||
CGM.getSanitizerMetadata()->reportGlobalToASan(var, D);
|
||||
CGM.getSanitizerMetadata()->reportGlobal(var, D);
|
||||
|
||||
// Emit global variable debug descriptor for static vars.
|
||||
CGDebugInfo *DI = getDebugInfo();
|
||||
|
|
|
@ -4795,7 +4795,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D,
|
|||
if (NeedsGlobalCtor || NeedsGlobalDtor)
|
||||
EmitCXXGlobalVarDeclInitFunc(D, GV, NeedsGlobalCtor);
|
||||
|
||||
SanitizerMD->reportGlobalToASan(GV, *D, NeedsGlobalCtor);
|
||||
SanitizerMD->reportGlobal(GV, *D, NeedsGlobalCtor);
|
||||
|
||||
// Emit global variable debug information.
|
||||
if (CGDebugInfo *DI = getModuleDebugInfo())
|
||||
|
@ -5677,8 +5677,8 @@ CodeGenModule::GetAddrOfConstantStringFromLiteral(const StringLiteral *S,
|
|||
if (Entry)
|
||||
*Entry = GV;
|
||||
|
||||
SanitizerMD->reportGlobalToASan(GV, S->getStrTokenLoc(0), "<string literal>",
|
||||
QualType());
|
||||
SanitizerMD->reportGlobal(GV, S->getStrTokenLoc(0), "<string literal>",
|
||||
QualType());
|
||||
|
||||
return ConstantAddress(castStringLiteralToDefaultAddressSpace(*this, GV),
|
||||
GV->getValueType(), Alignment);
|
||||
|
|
|
@ -28,10 +28,10 @@ static bool isAsanHwasanOrMemTag(const SanitizerSet& SS) {
|
|||
SanitizerKind::MemTag);
|
||||
}
|
||||
|
||||
void SanitizerMetadata::reportGlobalToASan(llvm::GlobalVariable *GV,
|
||||
SourceLocation Loc, StringRef Name,
|
||||
QualType Ty, bool IsDynInit,
|
||||
bool IsExcluded) {
|
||||
void SanitizerMetadata::reportGlobal(llvm::GlobalVariable *GV,
|
||||
SourceLocation Loc, StringRef Name,
|
||||
QualType Ty, bool IsDynInit,
|
||||
bool IsExcluded) {
|
||||
if (!isAsanHwasanOrMemTag(CGM.getLangOpts().Sanitize))
|
||||
return;
|
||||
IsDynInit &= !CGM.isInNoSanitizeList(GV, Loc, Ty, "init");
|
||||
|
@ -61,8 +61,8 @@ void SanitizerMetadata::reportGlobalToASan(llvm::GlobalVariable *GV,
|
|||
AsanGlobals->addOperand(ThisGlobal);
|
||||
}
|
||||
|
||||
void SanitizerMetadata::reportGlobalToASan(llvm::GlobalVariable *GV,
|
||||
const VarDecl &D, bool IsDynInit) {
|
||||
void SanitizerMetadata::reportGlobal(llvm::GlobalVariable *GV, const VarDecl &D,
|
||||
bool IsDynInit) {
|
||||
if (!isAsanHwasanOrMemTag(CGM.getLangOpts().Sanitize))
|
||||
return;
|
||||
std::string QualName;
|
||||
|
@ -75,15 +75,15 @@ void SanitizerMetadata::reportGlobalToASan(llvm::GlobalVariable *GV,
|
|||
IsExcluded = true;
|
||||
if (D.hasAttr<DisableSanitizerInstrumentationAttr>())
|
||||
IsExcluded = true;
|
||||
reportGlobalToASan(GV, D.getLocation(), OS.str(), D.getType(), IsDynInit,
|
||||
IsExcluded);
|
||||
reportGlobal(GV, D.getLocation(), OS.str(), D.getType(), IsDynInit,
|
||||
IsExcluded);
|
||||
}
|
||||
|
||||
void SanitizerMetadata::disableSanitizerForGlobal(llvm::GlobalVariable *GV) {
|
||||
// For now, just make sure the global is not modified by the ASan
|
||||
// instrumentation.
|
||||
if (isAsanHwasanOrMemTag(CGM.getLangOpts().Sanitize))
|
||||
reportGlobalToASan(GV, SourceLocation(), "", QualType(), false, true);
|
||||
reportGlobal(GV, SourceLocation(), "", QualType(), false, true);
|
||||
}
|
||||
|
||||
void SanitizerMetadata::disableSanitizerForInstruction(llvm::Instruction *I) {
|
||||
|
|
|
@ -36,11 +36,11 @@ class SanitizerMetadata {
|
|||
CodeGenModule &CGM;
|
||||
public:
|
||||
SanitizerMetadata(CodeGenModule &CGM);
|
||||
void reportGlobalToASan(llvm::GlobalVariable *GV, const VarDecl &D,
|
||||
bool IsDynInit = false);
|
||||
void reportGlobalToASan(llvm::GlobalVariable *GV, SourceLocation Loc,
|
||||
StringRef Name, QualType Ty, bool IsDynInit = false,
|
||||
bool IsExcluded = false);
|
||||
void reportGlobal(llvm::GlobalVariable *GV, const VarDecl &D,
|
||||
bool IsDynInit = false);
|
||||
void reportGlobal(llvm::GlobalVariable *GV, SourceLocation Loc,
|
||||
StringRef Name, QualType Ty, bool IsDynInit = false,
|
||||
bool IsExcluded = false);
|
||||
void disableSanitizerForGlobal(llvm::GlobalVariable *GV);
|
||||
void disableSanitizerForInstruction(llvm::Instruction *I);
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue