Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/lib/Basic/SanitizerBlacklist.cpp
Line
Count
Source
1
//===--- SanitizerBlacklist.cpp - Blacklist for sanitizers ----------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// User-provided blacklist used to disable/alter instrumentation done in
10
// sanitizers.
11
//
12
//===----------------------------------------------------------------------===//
13
#include "clang/Basic/SanitizerBlacklist.h"
14
15
using namespace clang;
16
17
SanitizerBlacklist::SanitizerBlacklist(
18
    const std::vector<std::string> &BlacklistPaths, SourceManager &SM)
19
41.7k
    : SSCL(SanitizerSpecialCaseList::createOrDie(BlacklistPaths)), SM(SM) {}
20
21
bool SanitizerBlacklist::isBlacklistedGlobal(SanitizerMask Mask,
22
                                             StringRef GlobalName,
23
324
                                             StringRef Category) const {
24
324
  return SSCL->inSection(Mask, "global", GlobalName, Category);
25
324
}
26
27
bool SanitizerBlacklist::isBlacklistedType(SanitizerMask Mask,
28
                                           StringRef MangledTypeName,
29
357
                                           StringRef Category) const {
30
357
  return SSCL->inSection(Mask, "type", MangledTypeName, Category);
31
357
}
32
33
bool SanitizerBlacklist::isBlacklistedFunction(SanitizerMask Mask,
34
5.99k
                                               StringRef FunctionName) const {
35
5.99k
  return SSCL->inSection(Mask, "fun", FunctionName);
36
5.99k
}
37
38
bool SanitizerBlacklist::isBlacklistedFile(SanitizerMask Mask,
39
                                           StringRef FileName,
40
6.36k
                                           StringRef Category) const {
41
6.36k
  return SSCL->inSection(Mask, "src", FileName, Category);
42
6.36k
}
43
44
bool SanitizerBlacklist::isBlacklistedLocation(SanitizerMask Mask,
45
                                               SourceLocation Loc,
46
6.32k
                                               StringRef Category) const {
47
6.32k
  return Loc.isValid() &&
48
6.32k
         
isBlacklistedFile(Mask, SM.getFilename(SM.getFileLoc(Loc)), Category)6.27k
;
49
6.32k
}
50