aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 6c33f92..bd7acf9 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1951,11 +1951,11 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
void CodeGenModule::reportGlobalToASan(llvm::GlobalVariable *GV,
SourceLocation Loc, StringRef Name,
- bool IsDynInit) {
+ bool IsDynInit, bool IsBlacklisted) {
if (!LangOpts.Sanitize.Address)
return;
IsDynInit &= !SanitizerBL.isIn(*GV, "init");
- bool IsBlacklisted = SanitizerBL.isIn(*GV);
+ IsBlacklisted |= SanitizerBL.isIn(*GV);
llvm::GlobalVariable *LocDescr = nullptr;
llvm::GlobalVariable *GlobalName = nullptr;
@@ -2008,6 +2008,13 @@ void CodeGenModule::reportGlobalToASan(llvm::GlobalVariable *GV,
reportGlobalToASan(GV, D.getLocation(), OS.str(), IsDynInit);
}
+void CodeGenModule::disableSanitizerForGlobal(llvm::GlobalVariable *GV) {
+ // For now, just make sure the global is not modified by the ASan
+ // instrumentation.
+ if (LangOpts.Sanitize.Address)
+ reportGlobalToASan(GV, SourceLocation(), "", false, true);
+}
+
static bool isVarDeclStrongDefinition(const VarDecl *D, bool NoCommon) {
// Don't give variables common linkage if -fno-common was specified unless it
// was overridden by a NoCommon attribute.