summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-03-06 10:54:18 +0000
committerAlexey Samsonov <samsonov@google.com>2013-03-06 10:54:18 +0000
commita1c0a2a2c649e7c1db1c62632bb0598c9bf66b71 (patch)
tree9071429b46096c7864ecb4a06fd13b3d6d8a94b3 /clang/lib/CodeGen/CodeGenModule.cpp
parent5d14fc061f3c233692f95c3bd1c61ec78f3ed29f (diff)
downloadbcm5719-llvm-a1c0a2a2c649e7c1db1c62632bb0598c9bf66b71.tar.gz
bcm5719-llvm-a1c0a2a2c649e7c1db1c62632bb0598c9bf66b71.zip
[Sanitize] Don't emit function attribute sanitize_address/thread/memory if the function is blacklisted.
llvm-svn: 176550
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index cae2c867db2..402b309f8ec 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/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)
OpenPOWER on IntegriCloud