Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:38

0001 //===- MemorySanitizer.h - MemorySanitizer instrumentation ------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file defines the memoy sanitizer pass.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H
0014 #define LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H
0015 
0016 #include "llvm/ADT/STLFunctionalExtras.h"
0017 #include "llvm/IR/PassManager.h"
0018 
0019 namespace llvm {
0020 class Module;
0021 class StringRef;
0022 class raw_ostream;
0023 
0024 struct MemorySanitizerOptions {
0025   MemorySanitizerOptions() : MemorySanitizerOptions(0, false, false, false){};
0026   MemorySanitizerOptions(int TrackOrigins, bool Recover, bool Kernel)
0027       : MemorySanitizerOptions(TrackOrigins, Recover, Kernel, false) {}
0028   MemorySanitizerOptions(int TrackOrigins, bool Recover, bool Kernel,
0029                          bool EagerChecks);
0030   bool Kernel;
0031   int TrackOrigins;
0032   bool Recover;
0033   bool EagerChecks;
0034 };
0035 
0036 /// A module pass for msan instrumentation.
0037 ///
0038 /// Instruments functions to detect unitialized reads. This function pass
0039 /// inserts calls to runtime library functions. If the functions aren't declared
0040 /// yet, the pass inserts the declarations. Otherwise the existing globals are
0041 /// used.
0042 struct MemorySanitizerPass : public PassInfoMixin<MemorySanitizerPass> {
0043   MemorySanitizerPass(MemorySanitizerOptions Options) : Options(Options) {}
0044 
0045   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
0046   void printPipeline(raw_ostream &OS,
0047                      function_ref<StringRef(StringRef)> MapClassName2PassName);
0048   static bool isRequired() { return true; }
0049 
0050 private:
0051   MemorySanitizerOptions Options;
0052 };
0053 }
0054 
0055 #endif /* LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H */