LLVM 22.0.0git
SanitizerCoverage.h
Go to the documentation of this file.
1//===--------- Definition of the SanitizerCoverage class --------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
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
8//
9//===----------------------------------------------------------------------===//
10//
11// SanitizerCoverage is a simple code coverage implementation.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_SANITIZERCOVERAGE_H
16#define LLVM_TRANSFORMS_INSTRUMENTATION_SANITIZERCOVERAGE_H
17
18#include "llvm/IR/PassManager.h"
23
24namespace llvm {
25class Module;
26
27/// This is the ModuleSanitizerCoverage pass used in the new pass manager. The
28/// pass instruments functions for coverage, adds initialization calls to the
29/// module for trace PC guards and 8bit counters if they are requested, and
30/// appends globals to llvm.compiler.used.
31class SanitizerCoveragePass : public PassInfoMixin<SanitizerCoveragePass> {
32public:
35 const std::vector<std::string> &AllowlistFiles =
36 std::vector<std::string>(),
37 const std::vector<std::string> &BlocklistFiles =
38 std::vector<std::string>())
39 : Options(Options) {
40 if (AllowlistFiles.size() > 0)
41 Allowlist = SpecialCaseList::createOrDie(AllowlistFiles,
43 if (BlocklistFiles.size() > 0)
44 Blocklist = SpecialCaseList::createOrDie(BlocklistFiles,
46 }
48 static bool isRequired() { return true; }
49
50private:
52
53 std::unique_ptr<SpecialCaseList> Allowlist;
54 std::unique_ptr<SpecialCaseList> Blocklist;
55};
56
57} // namespace llvm
58
59#endif
#define LLVM_ABI
Definition: Compiler.h:213
This header defines various interfaces for pass management in LLVM.
Machine Check Debug Module
Defines the virtual file system interface vfs::FileSystem.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:255
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:112
This is the ModuleSanitizerCoverage pass used in the new pass manager.
SanitizerCoveragePass(SanitizerCoverageOptions Options=SanitizerCoverageOptions(), const std::vector< std::string > &AllowlistFiles=std::vector< std::string >(), const std::vector< std::string > &BlocklistFiles=std::vector< std::string >())
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
static LLVM_ABI std::unique_ptr< SpecialCaseList > createOrDie(const std::vector< std::string > &Paths, llvm::vfs::FileSystem &FS)
Parses the special case list entries from files.
LLVM_ABI IntrusiveRefCntPtr< FileSystem > getRealFileSystem()
Gets an vfs::FileSystem for the 'real' file system, as seen by the operating system.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:70