forked from OSchip/llvm-project
[NFC] Move part of SanitizerMetadata into private method
This commit is contained in:
parent
5d9de5f446
commit
f32ad5703e
clang/lib/CodeGen
|
@ -5677,8 +5677,7 @@ CodeGenModule::GetAddrOfConstantStringFromLiteral(const StringLiteral *S,
|
|||
if (Entry)
|
||||
*Entry = GV;
|
||||
|
||||
SanitizerMD->reportGlobal(GV, S->getStrTokenLoc(0), "<string literal>",
|
||||
QualType());
|
||||
SanitizerMD->reportGlobal(GV, S->getStrTokenLoc(0), "<string literal>");
|
||||
|
||||
return ConstantAddress(castStringLiteralToDefaultAddressSpace(*this, GV),
|
||||
GV->getValueType(), Alignment);
|
||||
|
|
|
@ -32,8 +32,6 @@ 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");
|
||||
IsExcluded |= CGM.isInNoSanitizeList(GV, Loc, Ty);
|
||||
|
||||
|
@ -79,6 +77,14 @@ void SanitizerMetadata::reportGlobal(llvm::GlobalVariable *GV, const VarDecl &D,
|
|||
IsExcluded);
|
||||
}
|
||||
|
||||
void SanitizerMetadata::reportGlobal(llvm::GlobalVariable *GV,
|
||||
SourceLocation Loc, StringRef Name,
|
||||
QualType Ty, bool IsDynInit) {
|
||||
if (!isAsanHwasanOrMemTag(CGM.getLangOpts().Sanitize))
|
||||
return;
|
||||
reportGlobal(GV, Loc, Name, Ty, IsDynInit, false);
|
||||
}
|
||||
|
||||
void SanitizerMetadata::disableSanitizerForGlobal(llvm::GlobalVariable *GV) {
|
||||
// For now, just make sure the global is not modified by the ASan
|
||||
// instrumentation.
|
||||
|
|
|
@ -40,12 +40,14 @@ public:
|
|||
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);
|
||||
StringRef Name, QualType Ty = {}, bool IsDynInit = false);
|
||||
void disableSanitizerForGlobal(llvm::GlobalVariable *GV);
|
||||
void disableSanitizerForInstruction(llvm::Instruction *I);
|
||||
|
||||
private:
|
||||
void reportGlobal(llvm::GlobalVariable *GV, SourceLocation Loc,
|
||||
StringRef Name, QualType Ty, bool IsDynInit,
|
||||
bool IsExcluded);
|
||||
llvm::MDNode *getLocationMetadata(SourceLocation Loc);
|
||||
};
|
||||
} // end namespace CodeGen
|
||||
|
|
Loading…
Reference in New Issue