Coverage Report

Created: 2017-10-03 07:32

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/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 = false;
34
  bool CfiCrossDso = false;
35
  int AsanFieldPadding = 0;
36
  bool AsanSharedRuntime = false;
37
  bool AsanUseAfterScope = true;
38
  bool AsanGlobalsDeadStripping = false;
39
  bool LinkCXXRuntimes = false;
40
  bool NeedPIE = false;
41
  bool SafeStackRuntime = false;
42
  bool Stats = false;
43
  bool TsanMemoryAccess = true;
44
  bool TsanFuncEntryExit = true;
45
  bool TsanAtomics = true;
46
  bool MinimalRuntime = false;
47
48
 public:
49
  /// Parses the sanitizer arguments from an argument list.
50
  SanitizerArgs(const ToolChain &TC, const llvm::opt::ArgList &Args);
51
52
6.89k
  bool needsAsanRt() const { return Sanitizers.has(SanitizerKind::Address); }
53
158
  bool needsSharedAsanRt() const { return AsanSharedRuntime; }
54
5.27k
  bool needsTsanRt() const { return Sanitizers.has(SanitizerKind::Thread); }
55
1.08k
  bool needsMsanRt() const { return Sanitizers.has(SanitizerKind::Memory); }
56
5.43k
  bool needsFuzzer() const { return Sanitizers.has(SanitizerKind::Fuzzer); }
57
5.27k
  bool needsLsanRt() const {
58
5.27k
    return Sanitizers.has(SanitizerKind::Leak) &&
59
28
           !Sanitizers.has(SanitizerKind::Address);
60
5.27k
  }
61
  bool needsUbsanRt() const;
62
82
  bool requiresMinimalRuntime() const { return MinimalRuntime; }
63
1.08k
  bool needsDfsanRt() const { return Sanitizers.has(SanitizerKind::DataFlow); }
64
5.33k
  bool needsSafeStackRt() const { return SafeStackRuntime; }
65
  bool needsCfiRt() const;
66
  bool needsCfiDiagRt() const;
67
7.15k
  bool needsStatsRt() const { return Stats; }
68
5.27k
  bool needsEsanRt() const {
69
5.27k
    return Sanitizers.hasOneOf(SanitizerKind::Efficiency);
70
5.27k
  }
71
72
  bool requiresPIE() const;
73
  bool needsUnwindTables() const;
74
181
  bool linkCXXRuntimes() const { return LinkCXXRuntimes; }
75
1.24k
  bool hasCrossDsoCfi() const { return CfiCrossDso; }
76
  void addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
77
               llvm::opt::ArgStringList &CmdArgs, types::ID InputType) const;
78
};
79
80
}  // namespace driver
81
}  // namespace clang
82
83
#endif