diff options
| author | Alexey Samsonov <vonosmas@gmail.com> | 2014-10-15 22:17:27 +0000 |
|---|---|---|
| committer | Alexey Samsonov <vonosmas@gmail.com> | 2014-10-15 22:17:27 +0000 |
| commit | 0b15e34bd15e24d6f52bfc259a44e0d149cbf54b (patch) | |
| tree | cc9c6972c90ab959b68b370638b2849843cce2a5 /clang/lib | |
| parent | 026aa4962af114dc574f67dc211fb01ff23dc966 (diff) | |
| download | bcm5719-llvm-0b15e34bd15e24d6f52bfc259a44e0d149cbf54b.tar.gz bcm5719-llvm-0b15e34bd15e24d6f52bfc259a44e0d149cbf54b.zip | |
Move SanitizerBlacklist object from CodeGenModule to ASTContext.
Soon we'll need to have access to blacklist before the CodeGen
phase (see http://reviews.llvm.org/D5687), so parse and construct
the blacklist earlier.
llvm-svn: 219857
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 47 | ||||
| -rw-r--r-- | clang/lib/Basic/SanitizerBlacklist.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 6 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 4 |
4 files changed, 26 insertions, 34 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 09638916cf0..b33fdb4c707 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -722,35 +722,28 @@ static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI, llvm_unreachable("getAddressSpaceMapMangling() doesn't cover anything."); } -ASTContext::ASTContext(LangOptions& LOpts, SourceManager &SM, +ASTContext::ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents, SelectorTable &sels, Builtin::Context &builtins) - : FunctionProtoTypes(this_()), - TemplateSpecializationTypes(this_()), - DependentTemplateSpecializationTypes(this_()), - SubstTemplateTemplateParmPacks(this_()), - GlobalNestedNameSpecifier(nullptr), - Int128Decl(nullptr), UInt128Decl(nullptr), Float128StubDecl(nullptr), - BuiltinVaListDecl(nullptr), - ObjCIdDecl(nullptr), ObjCSelDecl(nullptr), ObjCClassDecl(nullptr), - ObjCProtocolClassDecl(nullptr), BOOLDecl(nullptr), - CFConstantStringTypeDecl(nullptr), ObjCInstanceTypeDecl(nullptr), - FILEDecl(nullptr), - jmp_bufDecl(nullptr), sigjmp_bufDecl(nullptr), ucontext_tDecl(nullptr), - BlockDescriptorType(nullptr), BlockDescriptorExtendedType(nullptr), - cudaConfigureCallDecl(nullptr), - NullTypeSourceInfo(QualType()), - FirstLocalImport(), LastLocalImport(), - SourceMgr(SM), LangOpts(LOpts), - AddrSpaceMap(nullptr), Target(nullptr), PrintingPolicy(LOpts), - Idents(idents), Selectors(sels), - BuiltinInfo(builtins), - DeclarationNames(*this), - ExternalSource(nullptr), Listener(nullptr), - Comments(SM), CommentsLoaded(false), - CommentCommandTraits(BumpAlloc, LOpts.CommentOpts), - LastSDM(nullptr, 0) -{ + : FunctionProtoTypes(this_()), TemplateSpecializationTypes(this_()), + DependentTemplateSpecializationTypes(this_()), + SubstTemplateTemplateParmPacks(this_()), + GlobalNestedNameSpecifier(nullptr), Int128Decl(nullptr), + UInt128Decl(nullptr), Float128StubDecl(nullptr), + BuiltinVaListDecl(nullptr), ObjCIdDecl(nullptr), ObjCSelDecl(nullptr), + ObjCClassDecl(nullptr), ObjCProtocolClassDecl(nullptr), BOOLDecl(nullptr), + CFConstantStringTypeDecl(nullptr), ObjCInstanceTypeDecl(nullptr), + FILEDecl(nullptr), jmp_bufDecl(nullptr), sigjmp_bufDecl(nullptr), + ucontext_tDecl(nullptr), BlockDescriptorType(nullptr), + BlockDescriptorExtendedType(nullptr), cudaConfigureCallDecl(nullptr), + NullTypeSourceInfo(QualType()), FirstLocalImport(), LastLocalImport(), + SourceMgr(SM), LangOpts(LOpts), + SanitizerBL(new SanitizerBlacklist(LangOpts.Sanitize.BlacklistFile)), + AddrSpaceMap(nullptr), Target(nullptr), PrintingPolicy(LOpts), + Idents(idents), Selectors(sels), BuiltinInfo(builtins), + DeclarationNames(*this), ExternalSource(nullptr), Listener(nullptr), + Comments(SM), CommentsLoaded(false), + CommentCommandTraits(BumpAlloc, LOpts.CommentOpts), LastSDM(nullptr, 0) { TUDecl = TranslationUnitDecl::Create(*this); } diff --git a/clang/lib/Basic/SanitizerBlacklist.cpp b/clang/lib/Basic/SanitizerBlacklist.cpp index f96ebc0d9dd..05dec8b5b83 100644 --- a/clang/lib/Basic/SanitizerBlacklist.cpp +++ b/clang/lib/Basic/SanitizerBlacklist.cpp @@ -29,6 +29,9 @@ static StringRef GetGlobalTypeString(const llvm::GlobalValue &G) { return "<unknown type>"; } +SanitizerBlacklist::SanitizerBlacklist(const std::string &BlacklistPath) + : SCL(llvm::SpecialCaseList::createOrDie(BlacklistPath)) {} + bool SanitizerBlacklist::isIn(const llvm::Module &M, StringRef Category) const { return SCL->inSection("src", M.getModuleIdentifier(), Category); diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 587fc139150..f8db0eeaf86 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -89,9 +89,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO, NSConcreteStackBlock(nullptr), BlockObjectAssign(nullptr), BlockObjectDispose(nullptr), BlockDescriptorType(nullptr), GenericBlockLiteralType(nullptr), LifetimeStartFn(nullptr), - LifetimeEndFn(nullptr), SanitizerBL(llvm::SpecialCaseList::createOrDie( - LangOpts.Sanitize.BlacklistFile)), - SanitizerMD(new SanitizerMetadata(*this)) { + LifetimeEndFn(nullptr), SanitizerMD(new SanitizerMetadata(*this)) { // Initialize the type cache. llvm::LLVMContext &LLVMContext = M.getContext(); @@ -743,7 +741,7 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, B.addAttribute(llvm::Attribute::StackProtectReq); // Add sanitizer attributes if function is not blacklisted. - if (!SanitizerBL.isIn(*F)) { + if (!getSanitizerBlacklist().isIn(*F)) { // When AddressSanitizer is enabled, set SanitizeAddress attribute // unless __attribute__((no_sanitize_address)) is used. if (LangOpts.Sanitize.Address && !D->hasAttr<NoSanitizeAddressAttr>()) diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 47ff8cd2842..c5c9d6eccc4 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -475,8 +475,6 @@ class CodeGenModule : public CodeGenTypeCache { GlobalDecl initializedGlobalDecl; - SanitizerBlacklist SanitizerBL; - std::unique_ptr<SanitizerMetadata> SanitizerMD; /// @} @@ -1048,7 +1046,7 @@ public: void AddGlobalAnnotations(const ValueDecl *D, llvm::GlobalValue *GV); const SanitizerBlacklist &getSanitizerBlacklist() const { - return SanitizerBL; + return Context.getSanitizerBlacklist(); } SanitizerMetadata *getSanitizerMetadata() { |

