1 //===--------- Definition of the SanitizerCoverage class --------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6 // See https://llvm.org/LICENSE.txt for license information.
7 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9 //===----------------------------------------------------------------------===//
11 // This file declares the SanitizerCoverage class which is a port of the legacy
12 // SanitizerCoverage pass to use the new PassManager infrastructure.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_SANITIZERCOVERAGE_H
17 #define LLVM_TRANSFORMS_INSTRUMENTATION_SANITIZERCOVERAGE_H
19 #include "llvm/IR/Module.h"
20 #include "llvm/IR/PassManager.h"
21 #include "llvm/Transforms/Instrumentation.h"
25 /// This is the ModuleSanitizerCoverage pass used in the new pass manager. The
26 /// pass instruments functions for coverage, adds initialization calls to the
27 /// module for trace PC guards and 8bit counters if they are requested, and
28 /// appends globals to llvm.compiler.used.
29 class ModuleSanitizerCoveragePass
30 : public PassInfoMixin
<ModuleSanitizerCoveragePass
> {
32 explicit ModuleSanitizerCoveragePass(
33 SanitizerCoverageOptions Options
= SanitizerCoverageOptions())
35 PreservedAnalyses
run(Module
&M
, ModuleAnalysisManager
&AM
);
38 SanitizerCoverageOptions Options
;
41 // Insert SanitizerCoverage instrumentation.
42 ModulePass
*createModuleSanitizerCoverageLegacyPassPass(
43 const SanitizerCoverageOptions
&Options
= SanitizerCoverageOptions());