1//===--------- Definition of the HWAddressSanitizer class -------*- 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//
10// This file declares the Hardware AddressSanitizer class which is a port of the
11// legacy HWAddressSanitizer pass to use the new PassManager infrastructure.
12//
13//===----------------------------------------------------------------------===//
14#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_HWADDRESSSANITIZERPASS_H
15#define LLVM_TRANSFORMS_INSTRUMENTATION_HWADDRESSSANITIZERPASS_H
16
17#include "llvm/IR/Function.h"
18#include "llvm/IR/PassManager.h"
19
20namespace llvm {
21
22/// This is a public interface to the hardware address sanitizer pass for
23/// instrumenting code to check for various memory errors at runtime, similar to
24/// AddressSanitizer but based on partial hardware assistance.
25class HWAddressSanitizerPass : public PassInfoMixin<HWAddressSanitizerPass> {
26public:
27  explicit HWAddressSanitizerPass(bool CompileKernel = false,
28                                  bool Recover = false);
29  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
30
31private:
32  bool CompileKernel;
33  bool Recover;
34};
35
36FunctionPass *createHWAddressSanitizerLegacyPassPass(bool CompileKernel = false,
37                                                     bool Recover = false);
38
39} // namespace llvm
40
41#endif
42