diff options
author | Alexey Samsonov <samsonov@google.com> | 2013-03-06 10:54:18 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2013-03-06 10:54:18 +0000 |
commit | 7e73f94c104070cf03c6f711a10f1928a550193f (patch) | |
tree | c9366675145954629a94f7ba4f8366e7e70c8062 /lib/CodeGen | |
parent | 360355db57d15ce3c90051b05cca993a4c5ee8db (diff) |
[Sanitize] Don't emit function attribute sanitize_address/thread/memory if the function is blacklisted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176550 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index cae2c867db..402b309f8e 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -619,16 +619,20 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, else if (LangOpts.getStackProtector() == LangOptions::SSPReq) F->addFnAttr(llvm::Attribute::StackProtectReq); - // When AddressSanitizer is enabled, set SanitizeAddress attribute - // unless __attribute__((no_sanitize_address)) is used. - if (SanOpts.Address && !D->hasAttr<NoSanitizeAddressAttr>()) - F->addFnAttr(llvm::Attribute::SanitizeAddress); - // Same for ThreadSanitizer and __attribute__((no_sanitize_thread)) - if (SanOpts.Thread && !D->hasAttr<NoSanitizeThreadAttr>()) - F->addFnAttr(llvm::Attribute::SanitizeThread); - // Same for MemorySanitizer and __attribute__((no_sanitize_memory)) - if (SanOpts.Memory && !D->hasAttr<NoSanitizeMemoryAttr>()) - F->addFnAttr(llvm::Attribute::SanitizeMemory); + // Add sanitizer attributes if function is not blacklisted. + if (!SanitizerBlacklist.isIn(*F)) { + // When AddressSanitizer is enabled, set SanitizeAddress attribute + // unless __attribute__((no_sanitize_address)) is used. + if (SanOpts.Address && !D->hasAttr<NoSanitizeAddressAttr>()) + F->addFnAttr(llvm::Attribute::SanitizeAddress); + // Same for ThreadSanitizer and __attribute__((no_sanitize_thread)) + if (SanOpts.Thread && !D->hasAttr<NoSanitizeThreadAttr>()) { + F->addFnAttr(llvm::Attribute::SanitizeThread); + } + // Same for MemorySanitizer and __attribute__((no_sanitize_memory)) + if (SanOpts.Memory && !D->hasAttr<NoSanitizeMemoryAttr>()) + F->addFnAttr(llvm::Attribute::SanitizeMemory); + } unsigned alignment = D->getMaxAlignment() / Context.getCharWidth(); if (alignment) |