diff options
author | Will Dietz <wdietz2@illinois.edu> | 2013-01-18 11:30:38 +0000 |
---|---|---|
committer | Will Dietz <wdietz2@illinois.edu> | 2013-01-18 11:30:38 +0000 |
commit | f54319c891d806e410ac09caac35462cf95b8cce (patch) | |
tree | 195d8af1cea50e7be3e52d45a6c116ed7c578ef3 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 63c36bbe5e0ae8d64df8c2a3be6c0b072febdc9a (diff) | |
download | bcm5719-llvm-f54319c891d806e410ac09caac35462cf95b8cce.tar.gz bcm5719-llvm-f54319c891d806e410ac09caac35462cf95b8cce.zip |
[ubsan] Add support for -fsanitize-blacklist
llvm-svn: 172808
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 04a08a92d87..9faba754334 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -77,8 +77,11 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO, VMContext(M.getContext()), NSConcreteGlobalBlock(0), NSConcreteStackBlock(0), BlockObjectAssign(0), BlockObjectDispose(0), - BlockDescriptorType(0), GenericBlockLiteralType(0) { - + BlockDescriptorType(0), GenericBlockLiteralType(0), + SanitizerBlacklist(CGO.SanitizerBlacklistFile), + SanOpts(SanitizerBlacklist.isIn(M) ? + SanitizerOptions::Disabled : LangOpts.Sanitize) { + // Initialize the type cache. llvm::LLVMContext &LLVMContext = M.getContext(); VoidTy = llvm::Type::getVoidTy(LLVMContext); @@ -104,7 +107,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO, createCUDARuntime(); // Enable TBAA unless it's suppressed. ThreadSanitizer needs TBAA even at O0. - if (LangOpts.SanitizeThread || + if (SanOpts.Thread || (!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0)) TBAA = new CodeGenTBAA(Context, VMContext, CodeGenOpts, getLangOpts(), ABI.getMangleContext()); @@ -603,8 +606,8 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, F->addFnAttr(llvm::Attribute::StackProtect); else if (LangOpts.getStackProtector() == LangOptions::SSPReq) F->addFnAttr(llvm::Attribute::StackProtectReq); - - if (LangOpts.SanitizeAddress) { + + if (SanOpts.Address) { // When AddressSanitizer is enabled, set AddressSafety attribute // unless __attribute__((no_address_safety_analysis)) is used. if (!D->hasAttr<NoAddressSafetyAnalysisAttr>()) @@ -1851,7 +1854,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { // If we are compiling with ASan, add metadata indicating dynamically // initialized globals. - if (LangOpts.SanitizeAddress && NeedsGlobalCtor) { + if (SanOpts.Address && NeedsGlobalCtor) { llvm::Module &M = getModule(); llvm::NamedMDNode *DynamicInitializers = |