Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pmbaty 1
//===- Transforms/Instrumentation/MemorySanitizer.h - MSan Pass -----------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file defines the memoy sanitizer pass.
10
//
11
//===----------------------------------------------------------------------===//
12
 
13
#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H
14
#define LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H
15
 
16
#include "llvm/ADT/STLFunctionalExtras.h"
17
#include "llvm/IR/PassManager.h"
18
 
19
namespace llvm {
20
class Module;
21
class StringRef;
22
class raw_ostream;
23
 
24
struct MemorySanitizerOptions {
25
  MemorySanitizerOptions() : MemorySanitizerOptions(0, false, false, false){};
26
  MemorySanitizerOptions(int TrackOrigins, bool Recover, bool Kernel)
27
      : MemorySanitizerOptions(TrackOrigins, Recover, Kernel, false) {}
28
  MemorySanitizerOptions(int TrackOrigins, bool Recover, bool Kernel,
29
                         bool EagerChecks);
30
  bool Kernel;
31
  int TrackOrigins;
32
  bool Recover;
33
  bool EagerChecks;
34
};
35
 
36
/// A module pass for msan instrumentation.
37
///
38
/// Instruments functions to detect unitialized reads. This function pass
39
/// inserts calls to runtime library functions. If the functions aren't declared
40
/// yet, the pass inserts the declarations. Otherwise the existing globals are
41
/// used.
42
struct MemorySanitizerPass : public PassInfoMixin<MemorySanitizerPass> {
43
  MemorySanitizerPass(MemorySanitizerOptions Options) : Options(Options) {}
44
 
45
  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
46
  void printPipeline(raw_ostream &OS,
47
                     function_ref<StringRef(StringRef)> MapClassName2PassName);
48
  static bool isRequired() { return true; }
49
 
50
private:
51
  MemorySanitizerOptions Options;
52
};
53
}
54
 
55
#endif /* LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H */