#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/Linkage.h"
+#include "clang/Basic/NoSanitizeList.h"
#include "clang/Basic/OperatorKinds.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/ProfileList.h"
-#include "clang/Basic/SanitizerBlacklist.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/XRayLists.h"
/// this ASTContext object.
LangOptions &LangOpts;
- /// Blacklist object that is used by sanitizers to decide which
+ /// NoSanitizeList object that is used by sanitizers to decide which
/// entities should not be instrumented.
- std::unique_ptr<SanitizerBlacklist> SanitizerBL;
+ std::unique_ptr<NoSanitizeList> NoSanitizeL;
/// Function filtering mechanism to determine whether a given function
/// should be imbued with the XRay "always" or "never" attributes.
return LangOpts.CPlusPlus || LangOpts.RecoveryAST;
}
- const SanitizerBlacklist &getSanitizerBlacklist() const {
- return *SanitizerBL;
- }
+ const NoSanitizeList &getNoSanitizeList() const { return *NoSanitizeL; }
const XRayFunctionFilter &getXRayFilter() const {
return *XRayFilter;
/// Set of enabled sanitizers.
SanitizerSet Sanitize;
- /// Paths to blacklist files specifying which objects
+ /// Paths to files specifying which objects
/// (files, functions, variables) should not be instrumented.
- std::vector<std::string> SanitizerBlacklistFiles;
+ std::vector<std::string> NoSanitizeFiles;
/// Paths to the XRay "always instrument" files specifying which
/// objects (files, functions, variables) should be imbued with the XRay
--- /dev/null
+//===--- NoSanitizeList.h - List of ignored entities for sanitizers --*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// User-provided list of ignored entities used to disable/alter
+// instrumentation done in sanitizers.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_CLANG_BASIC_NOSANITIZELIST_H
+#define LLVM_CLANG_BASIC_NOSANITIZELIST_H
+
+#include "clang/Basic/LLVM.h"
+#include "clang/Basic/SourceLocation.h"
+#include "llvm/ADT/StringRef.h"
+#include <memory>
+#include <vector>
+
+namespace clang {
+
+class SanitizerMask;
+class SourceManager;
+class SanitizerSpecialCaseList;
+
+class NoSanitizeList {
+ std::unique_ptr<SanitizerSpecialCaseList> SSCL;
+ SourceManager &SM;
+
+public:
+ NoSanitizeList(const std::vector<std::string> &NoSanitizeListPaths,
+ SourceManager &SM);
+ ~NoSanitizeList();
+ bool containsGlobal(SanitizerMask Mask, StringRef GlobalName,
+ StringRef Category = StringRef()) const;
+ bool containsType(SanitizerMask Mask, StringRef MangledTypeName,
+ StringRef Category = StringRef()) const;
+ bool containsFunction(SanitizerMask Mask, StringRef FunctionName) const;
+ bool containsFile(SanitizerMask Mask, StringRef FileName,
+ StringRef Category = StringRef()) const;
+ bool containsLocation(SanitizerMask Mask, SourceLocation Loc,
+ StringRef Category = StringRef()) const;
+};
+
+} // end namespace clang
+
+#endif
+++ /dev/null
-//===--- SanitizerBlacklist.h - Blacklist for sanitizers --------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// User-provided blacklist used to disable/alter instrumentation done in
-// sanitizers.
-//
-//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_BASIC_SANITIZERBLACKLIST_H
-#define LLVM_CLANG_BASIC_SANITIZERBLACKLIST_H
-
-#include "clang/Basic/LLVM.h"
-#include "clang/Basic/SourceLocation.h"
-#include "llvm/ADT/StringRef.h"
-#include <memory>
-#include <vector>
-
-namespace clang {
-
-class SanitizerMask;
-class SourceManager;
-class SanitizerSpecialCaseList;
-
-class SanitizerBlacklist {
- std::unique_ptr<SanitizerSpecialCaseList> SSCL;
- SourceManager &SM;
-
-public:
- SanitizerBlacklist(const std::vector<std::string> &BlacklistPaths,
- SourceManager &SM);
- ~SanitizerBlacklist();
- bool isBlacklistedGlobal(SanitizerMask Mask, StringRef GlobalName,
- StringRef Category = StringRef()) const;
- bool isBlacklistedType(SanitizerMask Mask, StringRef MangledTypeName,
- StringRef Category = StringRef()) const;
- bool isBlacklistedFunction(SanitizerMask Mask, StringRef FunctionName) const;
- bool isBlacklistedFile(SanitizerMask Mask, StringRef FileName,
- StringRef Category = StringRef()) const;
- bool isBlacklistedLocation(SanitizerMask Mask, SourceLocation Loc,
- StringRef Category = StringRef()) const;
-};
-
-} // end namespace clang
-
-#endif
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/Linkage.h"
#include "clang/Basic/Module.h"
+#include "clang/Basic/NoSanitizeList.h"
#include "clang/Basic/ObjCRuntime.h"
-#include "clang/Basic/SanitizerBlacklist.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Specifiers.h"
DependentTemplateSpecializationTypes(this_()), AutoTypes(this_()),
SubstTemplateTemplateParmPacks(this_()),
CanonTemplateTemplateParms(this_()), SourceMgr(SM), LangOpts(LOpts),
- SanitizerBL(new SanitizerBlacklist(LangOpts.SanitizerBlacklistFiles, SM)),
+ NoSanitizeL(new NoSanitizeList(LangOpts.NoSanitizeFiles, SM)),
XRayFilter(new XRayFunctionFilter(LangOpts.XRayAlwaysInstrumentFiles,
LangOpts.XRayNeverInstrumentFiles,
LangOpts.XRayAttrListFiles, SM)),
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/Linkage.h"
#include "clang/Basic/Module.h"
+#include "clang/Basic/NoSanitizeList.h"
#include "clang/Basic/PartialDiagnostic.h"
-#include "clang/Basic/SanitizerBlacklist.h"
#include "clang/Basic/Sanitizers.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
(SanitizerKind::Address | SanitizerKind::KernelAddress);
if (!EnabledAsanMask || !Context.getLangOpts().SanitizeAddressFieldPadding)
return false;
- const auto &Blacklist = Context.getSanitizerBlacklist();
+ const auto &NoSanitizeList = Context.getNoSanitizeList();
const auto *CXXRD = dyn_cast<CXXRecordDecl>(this);
// We may be able to relax some of these requirements.
int ReasonToReject = -1;
ReasonToReject = 4; // has trivial destructor.
else if (CXXRD->isStandardLayout())
ReasonToReject = 5; // is standard layout.
- else if (Blacklist.isBlacklistedLocation(EnabledAsanMask, getLocation(),
+ else if (NoSanitizeList.containsLocation(EnabledAsanMask, getLocation(),
"field-padding"))
ReasonToReject = 6; // is in an excluded file.
- else if (Blacklist.isBlacklistedType(EnabledAsanMask,
- getQualifiedNameAsString(),
- "field-padding"))
+ else if (NoSanitizeList.containsType(
+ EnabledAsanMask, getQualifiedNameAsString(), "field-padding"))
ReasonToReject = 7; // The type is excluded.
if (EmitRemark) {
OpenMPKinds.cpp
OperatorPrecedence.cpp
ProfileList.cpp
- SanitizerBlacklist.cpp
+ NoSanitizeList.cpp
SanitizerSpecialCaseList.cpp
Sanitizers.cpp
SourceLocation.cpp
#include "clang/Basic/LangOptions.def"
// These options do not affect AST generation.
- SanitizerBlacklistFiles.clear();
+ NoSanitizeFiles.clear();
XRayAlwaysInstrumentFiles.clear();
XRayNeverInstrumentFiles.clear();
--- /dev/null
+//===--- NoSanitizeList.cpp - Ignored list for sanitizers ----------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// User-provided ignore-list used to disable/alter instrumentation done in
+// sanitizers.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Basic/NoSanitizeList.h"
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/SanitizerSpecialCaseList.h"
+#include "clang/Basic/Sanitizers.h"
+#include "clang/Basic/SourceManager.h"
+
+using namespace clang;
+
+NoSanitizeList::NoSanitizeList(const std::vector<std::string> &NoSanitizePaths,
+ SourceManager &SM)
+ : SSCL(SanitizerSpecialCaseList::createOrDie(
+ NoSanitizePaths, SM.getFileManager().getVirtualFileSystem())),
+ SM(SM) {}
+
+NoSanitizeList::~NoSanitizeList() = default;
+
+bool NoSanitizeList::containsGlobal(SanitizerMask Mask, StringRef GlobalName,
+ StringRef Category) const {
+ return SSCL->inSection(Mask, "global", GlobalName, Category);
+}
+
+bool NoSanitizeList::containsType(SanitizerMask Mask, StringRef MangledTypeName,
+ StringRef Category) const {
+ return SSCL->inSection(Mask, "type", MangledTypeName, Category);
+}
+
+bool NoSanitizeList::containsFunction(SanitizerMask Mask,
+ StringRef FunctionName) const {
+ return SSCL->inSection(Mask, "fun", FunctionName);
+}
+
+bool NoSanitizeList::containsFile(SanitizerMask Mask, StringRef FileName,
+ StringRef Category) const {
+ return SSCL->inSection(Mask, "src", FileName, Category);
+}
+
+bool NoSanitizeList::containsLocation(SanitizerMask Mask, SourceLocation Loc,
+ StringRef Category) const {
+ return Loc.isValid() &&
+ containsFile(Mask, SM.getFilename(SM.getFileLoc(Loc)), Category);
+}
+++ /dev/null
-//===--- SanitizerBlacklist.cpp - Blacklist for sanitizers ----------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// User-provided blacklist used to disable/alter instrumentation done in
-// sanitizers.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Basic/SanitizerBlacklist.h"
-#include "clang/Basic/FileManager.h"
-#include "clang/Basic/SanitizerSpecialCaseList.h"
-#include "clang/Basic/Sanitizers.h"
-#include "clang/Basic/SourceManager.h"
-
-using namespace clang;
-
-SanitizerBlacklist::SanitizerBlacklist(
- const std::vector<std::string> &BlacklistPaths, SourceManager &SM)
- : SSCL(SanitizerSpecialCaseList::createOrDie(
- BlacklistPaths, SM.getFileManager().getVirtualFileSystem())),
- SM(SM) {}
-
-SanitizerBlacklist::~SanitizerBlacklist() = default;
-
-bool SanitizerBlacklist::isBlacklistedGlobal(SanitizerMask Mask,
- StringRef GlobalName,
- StringRef Category) const {
- return SSCL->inSection(Mask, "global", GlobalName, Category);
-}
-
-bool SanitizerBlacklist::isBlacklistedType(SanitizerMask Mask,
- StringRef MangledTypeName,
- StringRef Category) const {
- return SSCL->inSection(Mask, "type", MangledTypeName, Category);
-}
-
-bool SanitizerBlacklist::isBlacklistedFunction(SanitizerMask Mask,
- StringRef FunctionName) const {
- return SSCL->inSection(Mask, "fun", FunctionName);
-}
-
-bool SanitizerBlacklist::isBlacklistedFile(SanitizerMask Mask,
- StringRef FileName,
- StringRef Category) const {
- return SSCL->inSection(Mask, "src", FileName, Category);
-}
-
-bool SanitizerBlacklist::isBlacklistedLocation(SanitizerMask Mask,
- SourceLocation Loc,
- StringRef Category) const {
- return Loc.isValid() &&
- isBlacklistedFile(Mask, SM.getFilename(SM.getFileLoc(Loc)), Category);
-}
-
const PassManagerBuilderWrapper &BuilderWrapper =
static_cast<const PassManagerBuilderWrapper&>(Builder);
const LangOptions &LangOpts = BuilderWrapper.getLangOpts();
- PM.add(
- createDataFlowSanitizerLegacyPassPass(LangOpts.SanitizerBlacklistFiles));
+ PM.add(createDataFlowSanitizerLegacyPassPass(LangOpts.NoSanitizeFiles));
}
static TargetLibraryInfoImpl *createTLII(llvm::Triple &TargetTriple,
HWASanPass(SanitizerKind::KernelHWAddress, true);
if (LangOpts.Sanitize.has(SanitizerKind::DataFlow)) {
- MPM.addPass(DataFlowSanitizerPass(LangOpts.SanitizerBlacklistFiles));
+ MPM.addPass(DataFlowSanitizerPass(LangOpts.NoSanitizeFiles));
}
});
}
}
std::string TypeName = RD->getQualifiedNameAsString();
- if (getContext().getSanitizerBlacklist().isBlacklistedType(M, TypeName))
+ if (getContext().getNoSanitizeList().containsType(M, TypeName))
return;
SanitizerScope SanScope(this);
return false;
std::string TypeName = RD->getQualifiedNameAsString();
- return !getContext().getSanitizerBlacklist().isBlacklistedType(
- SanitizerKind::CFIVCall, TypeName);
+ return !getContext().getNoSanitizeList().containsType(SanitizerKind::CFIVCall,
+ TypeName);
}
llvm::Value *CodeGenFunction::EmitVTableTypeCheckedLoad(
std::string TypeName = RD->getQualifiedNameAsString();
if (SanOpts.has(SanitizerKind::CFIVCall) &&
- !getContext().getSanitizerBlacklist().isBlacklistedType(
- SanitizerKind::CFIVCall, TypeName)) {
+ !getContext().getNoSanitizeList().containsType(SanitizerKind::CFIVCall,
+ TypeName)) {
EmitCheck(std::make_pair(CheckResult, SanitizerKind::CFIVCall),
SanitizerHandler::CFICheckFail, {}, {});
}
Fn->setDoesNotThrow();
if (getLangOpts().Sanitize.has(SanitizerKind::Address) &&
- !isInSanitizerBlacklist(SanitizerKind::Address, Fn, Loc))
+ !isInNoSanitizeList(SanitizerKind::Address, Fn, Loc))
Fn->addFnAttr(llvm::Attribute::SanitizeAddress);
if (getLangOpts().Sanitize.has(SanitizerKind::KernelAddress) &&
- !isInSanitizerBlacklist(SanitizerKind::KernelAddress, Fn, Loc))
+ !isInNoSanitizeList(SanitizerKind::KernelAddress, Fn, Loc))
Fn->addFnAttr(llvm::Attribute::SanitizeAddress);
if (getLangOpts().Sanitize.has(SanitizerKind::HWAddress) &&
- !isInSanitizerBlacklist(SanitizerKind::HWAddress, Fn, Loc))
+ !isInNoSanitizeList(SanitizerKind::HWAddress, Fn, Loc))
Fn->addFnAttr(llvm::Attribute::SanitizeHWAddress);
if (getLangOpts().Sanitize.has(SanitizerKind::KernelHWAddress) &&
- !isInSanitizerBlacklist(SanitizerKind::KernelHWAddress, Fn, Loc))
+ !isInNoSanitizeList(SanitizerKind::KernelHWAddress, Fn, Loc))
Fn->addFnAttr(llvm::Attribute::SanitizeHWAddress);
if (getLangOpts().Sanitize.has(SanitizerKind::MemTag) &&
- !isInSanitizerBlacklist(SanitizerKind::MemTag, Fn, Loc))
+ !isInNoSanitizeList(SanitizerKind::MemTag, Fn, Loc))
Fn->addFnAttr(llvm::Attribute::SanitizeMemTag);
if (getLangOpts().Sanitize.has(SanitizerKind::Thread) &&
- !isInSanitizerBlacklist(SanitizerKind::Thread, Fn, Loc))
+ !isInNoSanitizeList(SanitizerKind::Thread, Fn, Loc))
Fn->addFnAttr(llvm::Attribute::SanitizeThread);
if (getLangOpts().Sanitize.has(SanitizerKind::Memory) &&
- !isInSanitizerBlacklist(SanitizerKind::Memory, Fn, Loc))
+ !isInNoSanitizeList(SanitizerKind::Memory, Fn, Loc))
Fn->addFnAttr(llvm::Attribute::SanitizeMemory);
if (getLangOpts().Sanitize.has(SanitizerKind::KernelMemory) &&
- !isInSanitizerBlacklist(SanitizerKind::KernelMemory, Fn, Loc))
+ !isInNoSanitizeList(SanitizerKind::KernelMemory, Fn, Loc))
Fn->addFnAttr(llvm::Attribute::SanitizeMemory);
if (getLangOpts().Sanitize.has(SanitizerKind::SafeStack) &&
- !isInSanitizerBlacklist(SanitizerKind::SafeStack, Fn, Loc))
+ !isInNoSanitizeList(SanitizerKind::SafeStack, Fn, Loc))
Fn->addFnAttr(llvm::Attribute::SafeStack);
if (getLangOpts().Sanitize.has(SanitizerKind::ShadowCallStack) &&
- !isInSanitizerBlacklist(SanitizerKind::ShadowCallStack, Fn, Loc))
+ !isInNoSanitizeList(SanitizerKind::ShadowCallStack, Fn, Loc))
Fn->addFnAttr(llvm::Attribute::ShadowCallStack);
return Fn;
CGM.getCXXABI().getMangleContext().mangleCXXRTTI(Ty.getUnqualifiedType(),
Out);
- // Blacklist based on the mangled type.
- if (!CGM.getContext().getSanitizerBlacklist().isBlacklistedType(
- SanitizerKind::Vptr, Out.str())) {
+ // Contained in NoSanitizeList based on the mangled type.
+ if (!CGM.getContext().getNoSanitizeList().containsType(SanitizerKind::Vptr,
+ Out.str())) {
llvm::hash_code TypeHash = hash_value(Out.str());
// Load the vptr, and compute hash_16_bytes(TypeHash, vptr).
StartFunction(GlobalDecl(), CGM.getContext().VoidTy, F, FI, Args,
SourceLocation());
- // This function should not be affected by blacklist. This function does
+ // This function is not affected by NoSanitizeList. This function does
// not have a source location, but "src:*" would still apply. Revert any
// changes to SanOpts made in StartFunction.
SanOpts = CGM.getLangOpts().Sanitize;
CurFnInfo = &FnInfo;
assert(CurFn->isDeclaration() && "Function already has body?");
- // If this function has been blacklisted for any of the enabled sanitizers,
+ // If this function is ignored for any of the enabled sanitizers,
// disable the sanitizer for the function.
do {
#define SANITIZER(NAME, ID) \
if (SanOpts.empty()) \
break; \
if (SanOpts.has(SanitizerKind::ID)) \
- if (CGM.isInSanitizerBlacklist(SanitizerKind::ID, Fn, Loc)) \
+ if (CGM.isInNoSanitizeList(SanitizerKind::ID, Fn, Loc)) \
SanOpts.set(SanitizerKind::ID, false);
#include "clang/Basic/Sanitizers.def"
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 |
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;
}
}
#include "clang/Basic/ABI.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/Module.h"
-#include "clang/Basic/SanitizerBlacklist.h"
+#include "clang/Basic/NoSanitizeList.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/XRayLists.h"
#include "llvm/ADT/DenseMap.h"
/// annotations are emitted during finalization of the LLVM code.
void AddGlobalAnnotations(const ValueDecl *D, llvm::GlobalValue *GV);
- bool isInSanitizerBlacklist(SanitizerMask Kind, llvm::Function *Fn,
- SourceLocation Loc) const;
+ bool isInNoSanitizeList(SanitizerMask Kind, llvm::Function *Fn,
+ SourceLocation Loc) const;
- bool isInSanitizerBlacklist(llvm::GlobalVariable *GV, SourceLocation Loc,
- QualType Ty,
- StringRef Category = StringRef()) const;
+ bool isInNoSanitizeList(llvm::GlobalVariable *GV, SourceLocation Loc,
+ QualType Ty, StringRef Category = StringRef()) const;
/// Imbue XRay attributes to a function, applying the always/never attribute
/// lists in the process. Returns true if we did imbue attributes this way,
-//===--- SanitizerMetadata.cpp - Blacklist for sanitizers -----------------===//
+//===--- SanitizerMetadata.cpp - Ignored entities for sanitizers ----------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
bool IsExcluded) {
if (!isAsanHwasanOrMemTag(CGM.getLangOpts().Sanitize))
return;
- IsDynInit &= !CGM.isInSanitizerBlacklist(GV, Loc, Ty, "init");
- IsExcluded |= CGM.isInSanitizerBlacklist(GV, Loc, Ty);
+ IsDynInit &= !CGM.isInNoSanitizeList(GV, Loc, Ty, "init");
+ IsExcluded |= CGM.isInNoSanitizeList(GV, Loc, Ty);
llvm::Metadata *LocDescr = nullptr;
llvm::Metadata *GlobalName = nullptr;
llvm::LLVMContext &VMContext = CGM.getLLVMContext();
if (!IsExcluded) {
- // Don't generate source location and global name if it is blacklisted -
- // it won't be instrumented anyway.
+ // Don't generate source location and global name if it is on
+ // the NoSanitizeList - it won't be instrumented anyway.
LocDescr = getLocationMetadata(Loc);
if (!Name.empty())
GlobalName = llvm::MDString::get(VMContext, Name);
GenerateArg(Args, OPT_fsanitize_EQ, Sanitizer, SA);
// Conflating '-fsanitize-system-blacklist' and '-fsanitize-blacklist'.
- for (const std::string &F : Opts.SanitizerBlacklistFiles)
+ for (const std::string &F : Opts.NoSanitizeFiles)
GenerateArg(Args, OPT_fsanitize_blacklist, F, SA);
if (Opts.getClangABICompat() == LangOptions::ClangABI::Ver3_8)
// Parse -fsanitize= arguments.
parseSanitizerKinds("-fsanitize=", Args.getAllArgValues(OPT_fsanitize_EQ),
Diags, Opts.Sanitize);
- Opts.SanitizerBlacklistFiles = Args.getAllArgValues(OPT_fsanitize_blacklist);
+ Opts.NoSanitizeFiles = Args.getAllArgValues(OPT_fsanitize_blacklist);
std::vector<std::string> systemBlacklists =
Args.getAllArgValues(OPT_fsanitize_system_blacklist);
- Opts.SanitizerBlacklistFiles.insert(Opts.SanitizerBlacklistFiles.end(),
- systemBlacklists.begin(),
- systemBlacklists.end());
+ Opts.NoSanitizeFiles.insert(Opts.NoSanitizeFiles.end(),
+ systemBlacklists.begin(), systemBlacklists.end());
if (Arg *A = Args.getLastArg(OPT_fclang_abi_compat_EQ)) {
Opts.setClangABICompat(LangOptions::ClangABI::Latest);