Coverage Report

Created: 2020-02-15 09:57

/Users/buildslave/jenkins/workspace/coverage/llvm-project/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
    : SSCL(SanitizerSpecialCaseList::createOrDie(
20
          BlacklistPaths, SM.getFileManager().getVirtualFileSystem())),
21
61.6k
      SM(SM) {}
22
23
bool SanitizerBlacklist::isBlacklistedGlobal(SanitizerMask Mask,
24
                                             StringRef GlobalName,
25
336
                                             StringRef Category) const {
26
336
  return SSCL->inSection(Mask, "global", GlobalName, Category);
27
336
}
28
29
bool SanitizerBlacklist::isBlacklistedType(SanitizerMask Mask,
30
                                           StringRef MangledTypeName,
31
371
                                           StringRef Category) const {
32
371
  return SSCL->inSection(Mask, "type", MangledTypeName, Category);
33
371
}
34
35
bool SanitizerBlacklist::isBlacklistedFunction(SanitizerMask Mask,
36
7.35k
                                               StringRef FunctionName) const {
37
7.35k
  return SSCL->inSection(Mask, "fun", FunctionName);
38
7.35k
}
39
40
bool SanitizerBlacklist::isBlacklistedFile(SanitizerMask Mask,
41
                                           StringRef FileName,
42
7.73k
                                           StringRef Category) const {
43
7.73k
  return SSCL->inSection(Mask, "src", FileName, Category);
44
7.73k
}
45
46
bool SanitizerBlacklist::isBlacklistedLocation(SanitizerMask Mask,
47
                                               SourceLocation Loc,
48
7.69k
                                               StringRef Category) const {
49
7.69k
  return Loc.isValid() &&
50
7.69k
         
isBlacklistedFile(Mask, SM.getFilename(SM.getFileLoc(Loc)), Category)7.63k
;
51
7.69k
}
52