diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2014-07-07 23:34:34 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2014-07-07 23:34:34 +0000 |
commit | a7f55380637d5d28eb24c18f474d02ce4dd8280b (patch) | |
tree | 7cf8a45fac510bd49d0e8ea432c657c0245da955 /lib/CodeGen/CGDeclCXX.cpp | |
parent | 7da527a5834666f101aead891a799699b28ec340 (diff) |
[Sanitizer] Reduce the usage of sanitizer blacklist in CodeGenModule
Get rid of cached CodeGenModule::SanOpts, which was used to turn off
sanitizer codegen options if current LLVM Module is blacklisted, and use
plain LangOpts.Sanitize instead.
1) Some codegen decisions (turning TBAA or writable strings on/off)
shouldn't depend on the contents of blacklist.
2) llvm.asan.globals should *always* be created, even if the module
is blacklisted - soon Clang's CodeGen where we read sanitizer
blacklist files, so we should properly report which globals are
blacklisted to the backend.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212499 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDeclCXX.cpp')
-rw-r--r-- | lib/CodeGen/CGDeclCXX.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/CodeGen/CGDeclCXX.cpp b/lib/CodeGen/CGDeclCXX.cpp index c2877409f7..6a03e9afe4 100644 --- a/lib/CodeGen/CGDeclCXX.cpp +++ b/lib/CodeGen/CGDeclCXX.cpp @@ -245,12 +245,14 @@ CreateGlobalInitOrDestructFunction(CodeGenModule &CGM, if (!CGM.getLangOpts().Exceptions) Fn->setDoesNotThrow(); - if (CGM.getSanOpts().Address) - Fn->addFnAttr(llvm::Attribute::SanitizeAddress); - if (CGM.getSanOpts().Thread) - Fn->addFnAttr(llvm::Attribute::SanitizeThread); - if (CGM.getSanOpts().Memory) - Fn->addFnAttr(llvm::Attribute::SanitizeMemory); + if (!CGM.getSanitizerBlacklist().isIn(*Fn)) { + if (CGM.getLangOpts().Sanitize.Address) + Fn->addFnAttr(llvm::Attribute::SanitizeAddress); + if (CGM.getLangOpts().Sanitize.Thread) + Fn->addFnAttr(llvm::Attribute::SanitizeThread); + if (CGM.getLangOpts().Sanitize.Memory) + Fn->addFnAttr(llvm::Attribute::SanitizeMemory); + } return Fn; } |