2014-07-10 03:40:08 +08:00
|
|
|
//===--- SanitizerBlacklist.cpp - Blacklist for sanitizers ----------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// User-provided blacklist used to disable/alter instrumentation done in
|
|
|
|
// sanitizers.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2014-10-16 03:57:45 +08:00
|
|
|
#include "clang/Basic/SanitizerBlacklist.h"
|
2014-07-10 03:40:08 +08:00
|
|
|
|
|
|
|
using namespace clang;
|
|
|
|
|
2015-02-05 01:40:08 +08:00
|
|
|
SanitizerBlacklist::SanitizerBlacklist(
|
|
|
|
const std::vector<std::string> &BlacklistPaths, SourceManager &SM)
|
|
|
|
: SCL(llvm::SpecialCaseList::createOrDie(BlacklistPaths)), SM(SM) {}
|
2014-10-16 06:17:27 +08:00
|
|
|
|
2014-10-18 06:37:33 +08:00
|
|
|
bool SanitizerBlacklist::isBlacklistedGlobal(StringRef GlobalName,
|
|
|
|
StringRef Category) const {
|
|
|
|
return SCL->inSection("global", GlobalName, Category);
|
2014-07-10 03:40:08 +08:00
|
|
|
}
|
2014-07-11 06:34:19 +08:00
|
|
|
|
2014-10-17 04:54:52 +08:00
|
|
|
bool SanitizerBlacklist::isBlacklistedType(StringRef MangledTypeName,
|
|
|
|
StringRef Category) const {
|
|
|
|
return SCL->inSection("type", MangledTypeName, Category);
|
2014-07-11 06:34:19 +08:00
|
|
|
}
|
2014-10-17 01:10:38 +08:00
|
|
|
|
|
|
|
bool SanitizerBlacklist::isBlacklistedFunction(StringRef FunctionName) const {
|
|
|
|
return SCL->inSection("fun", FunctionName);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SanitizerBlacklist::isBlacklistedFile(StringRef FileName,
|
|
|
|
StringRef Category) const {
|
|
|
|
return SCL->inSection("src", FileName, Category);
|
|
|
|
}
|
2014-10-17 07:50:26 +08:00
|
|
|
|
|
|
|
bool SanitizerBlacklist::isBlacklistedLocation(SourceLocation Loc,
|
|
|
|
StringRef Category) const {
|
2015-10-03 13:15:57 +08:00
|
|
|
return Loc.isValid() &&
|
2014-10-23 03:34:25 +08:00
|
|
|
isBlacklistedFile(SM.getFilename(SM.getFileLoc(Loc)), Category);
|
2014-10-17 07:50:26 +08:00
|
|
|
}
|
|
|
|
|