diff options
| author | Melanie Blower <melanie.blower@intel.com> | 2021-02-22 14:47:29 -0500 |
|---|---|---|
| committer | Melanie Blower <melanie.blower@intel.com> | 2021-02-22 15:11:37 -0500 |
| commit | e64fcdf8d53c1d2ab709394c39743fa11d270181 (patch) | |
| tree | 9791aa5ec49cf6ac5bdb3ecc03109aa810c8c907 /clang/lib/CodeGen/CodeGenModule.cpp | |
| parent | 1cd2a5a7da3db812fe2844caefcd40f8a52eff5b (diff) | |
[clang][patch] Inclusive language, modify filename SanitizerBlacklist.h to NoSanitizeList.h
This patch responds to a comment from @vitalybuka in D96203: suggestion to
do the change incrementally, and start by modifying this file name. I modified
the file name and made the other changes that follow from that rename.
Reviewers: vitalybuka, echristo, MaskRay, jansvoboda11, aaron.ballman
Differential Revision: https://reviews.llvm.org/D96974
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index ff36d5529d4c..d568e3d7095c 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2459,29 +2459,28 @@ void CodeGenModule::AddGlobalAnnotations(const ValueDecl *D, Annotations.push_back(EmitAnnotateAttr(GV, I, D->getLocation())); } -bool CodeGenModule::isInSanitizerBlacklist(SanitizerMask Kind, - llvm::Function *Fn, - SourceLocation Loc) const { - const auto &SanitizerBL = getContext().getSanitizerBlacklist(); - // Blacklist by function name. - if (SanitizerBL.isBlacklistedFunction(Kind, Fn->getName())) +bool CodeGenModule::isInNoSanitizeList(SanitizerMask Kind, llvm::Function *Fn, + SourceLocation Loc) const { + const auto &NoSanitizeL = getContext().getNoSanitizeList(); + // NoSanitize by function name. + if (NoSanitizeL.containsFunction(Kind, Fn->getName())) return true; - // Blacklist by location. + // NoSanitize by location. if (Loc.isValid()) - return SanitizerBL.isBlacklistedLocation(Kind, Loc); + return NoSanitizeL.containsLocation(Kind, Loc); // If location is unknown, this may be a compiler-generated function. Assume // it's located in the main file. auto &SM = Context.getSourceManager(); if (const auto *MainFile = SM.getFileEntryForID(SM.getMainFileID())) { - return SanitizerBL.isBlacklistedFile(Kind, MainFile->getName()); + return NoSanitizeL.containsFile(Kind, MainFile->getName()); } return false; } -bool CodeGenModule::isInSanitizerBlacklist(llvm::GlobalVariable *GV, - SourceLocation Loc, QualType Ty, - StringRef Category) const { - // For now globals can be blacklisted only in ASan and KASan. +bool CodeGenModule::isInNoSanitizeList(llvm::GlobalVariable *GV, + SourceLocation Loc, QualType Ty, + StringRef Category) const { + // For now globals can be ignored only in ASan and KASan. const SanitizerMask EnabledAsanMask = LangOpts.Sanitize.Mask & (SanitizerKind::Address | SanitizerKind::KernelAddress | @@ -2489,22 +2488,22 @@ bool CodeGenModule::isInSanitizerBlacklist(llvm::GlobalVariable *GV, SanitizerKind::MemTag); if (!EnabledAsanMask) return false; - const auto &SanitizerBL = getContext().getSanitizerBlacklist(); - if (SanitizerBL.isBlacklistedGlobal(EnabledAsanMask, GV->getName(), Category)) + const auto &NoSanitizeL = getContext().getNoSanitizeList(); + if (NoSanitizeL.containsGlobal(EnabledAsanMask, GV->getName(), Category)) return true; - if (SanitizerBL.isBlacklistedLocation(EnabledAsanMask, Loc, Category)) + if (NoSanitizeL.containsLocation(EnabledAsanMask, Loc, Category)) return true; // Check global type. if (!Ty.isNull()) { // Drill down the array types: if global variable of a fixed type is - // blacklisted, we also don't instrument arrays of them. + // not sanitized, we also don't instrument arrays of them. while (auto AT = dyn_cast<ArrayType>(Ty.getTypePtr())) Ty = AT->getElementType(); Ty = Ty.getCanonicalType().getUnqualifiedType(); - // We allow to blacklist only record types (classes, structs etc.) + // Only record types (classes, structs etc.) are ignored. if (Ty->isRecordType()) { std::string TypeStr = Ty.getAsString(getContext().getPrintingPolicy()); - if (SanitizerBL.isBlacklistedType(EnabledAsanMask, TypeStr, Category)) + if (NoSanitizeL.containsType(EnabledAsanMask, TypeStr, Category)) return true; } } |
