Coverage Report

Created: 2018-11-16 02:38

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/Driver/SanitizerArgs.h
Line
Count
Source
1
//===--- SanitizerArgs.h - Arguments for sanitizer tools  -------*- C++ -*-===//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
#ifndef LLVM_CLANG_DRIVER_SANITIZERARGS_H
10
#define LLVM_CLANG_DRIVER_SANITIZERARGS_H
11
12
#include "clang/Basic/Sanitizers.h"
13
#include "clang/Driver/Types.h"
14
#include "llvm/Option/Arg.h"
15
#include "llvm/Option/ArgList.h"
16
#include <string>
17
#include <vector>
18
19
namespace clang {
20
namespace driver {
21
22
class ToolChain;
23
24
class SanitizerArgs {
25
  SanitizerSet Sanitizers;
26
  SanitizerSet RecoverableSanitizers;
27
  SanitizerSet TrapSanitizers;
28
29
  std::vector<std::string> BlacklistFiles;
30
  std::vector<std::string> ExtraDeps;
31
  int CoverageFeatures = 0;
32
  int MsanTrackOrigins = 0;
33
  bool MsanUseAfterDtor = true;
34
  bool CfiCrossDso = false;
35
  bool CfiICallGeneralizePointers = false;
36
  int AsanFieldPadding = 0;
37
  bool SharedRuntime = false;
38
  bool AsanUseAfterScope = true;
39
  bool AsanPoisonCustomArrayCookie = false;
40
  bool AsanGlobalsDeadStripping = false;
41
  bool LinkCXXRuntimes = false;
42
  bool NeedPIE = false;
43
  bool SafeStackRuntime = false;
44
  bool Stats = false;
45
  bool TsanMemoryAccess = true;
46
  bool TsanFuncEntryExit = true;
47
  bool TsanAtomics = true;
48
  bool MinimalRuntime = false;
49
  // True if cross-dso CFI support if provided by the system (i.e. Android).
50
  bool ImplicitCfiRuntime = false;
51
52
 public:
53
  /// Parses the sanitizer arguments from an argument list.
54
  SanitizerArgs(const ToolChain &TC, const llvm::opt::ArgList &Args);
55
56
3.08k
  bool needsSharedRt() const { return SharedRuntime; }
57
58
9.53k
  bool needsAsanRt() const { return Sanitizers.has(SanitizerKind::Address); }
59
6.30k
  bool needsHwasanRt() const { return Sanitizers.has(SanitizerKind::HWAddress); }
60
8.58k
  bool needsTsanRt() const { return Sanitizers.has(SanitizerKind::Thread); }
61
6.14k
  bool needsMsanRt() const { return Sanitizers.has(SanitizerKind::Memory); }
62
4.38k
  bool needsFuzzer() const { return Sanitizers.has(SanitizerKind::Fuzzer); }
63
8.55k
  bool needsLsanRt() const {
64
8.55k
    return Sanitizers.has(SanitizerKind::Leak) &&
65
8.55k
           
!Sanitizers.has(SanitizerKind::Address)61
&&
66
8.55k
           
!Sanitizers.has(SanitizerKind::HWAddress)60
;
67
8.55k
  }
68
  bool needsUbsanRt() const;
69
163
  bool requiresMinimalRuntime() const { return MinimalRuntime; }
70
6.05k
  bool needsDfsanRt() const { return Sanitizers.has(SanitizerKind::DataFlow); }
71
1.33k
  bool needsSafeStackRt() const { return SafeStackRuntime; }
72
  bool needsCfiRt() const;
73
  bool needsCfiDiagRt() const;
74
6.14k
  bool needsStatsRt() const { return Stats; }
75
3.81k
  bool needsEsanRt() const {
76
3.81k
    return Sanitizers.hasOneOf(SanitizerKind::Efficiency);
77
3.81k
  }
78
6.20k
  bool needsScudoRt() const { return Sanitizers.has(SanitizerKind::Scudo); }
79
80
  bool requiresPIE() const;
81
  bool needsUnwindTables() const;
82
233
  bool linkCXXRuntimes() const { return LinkCXXRuntimes; }
83
1.56k
  bool hasCrossDsoCfi() const { return CfiCrossDso; }
84
  void addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
85
               llvm::opt::ArgStringList &CmdArgs, types::ID InputType) const;
86
};
87
88
}  // namespace driver
89
}  // namespace clang
90
91
#endif