File indexing completed on 2026-05-10 08:44:38
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_ADDRESSSANITIZER_H
0014 #define LLVM_TRANSFORMS_INSTRUMENTATION_ADDRESSSANITIZER_H
0015
0016 #include "llvm/IR/PassManager.h"
0017 #include "llvm/Transforms/Instrumentation/AddressSanitizerOptions.h"
0018
0019 namespace llvm {
0020 class Module;
0021 class raw_ostream;
0022
0023 struct AddressSanitizerOptions {
0024 bool CompileKernel = false;
0025 bool Recover = false;
0026 bool UseAfterScope = false;
0027 AsanDetectStackUseAfterReturnMode UseAfterReturn =
0028 AsanDetectStackUseAfterReturnMode::Runtime;
0029 int InstrumentationWithCallsThreshold = 7000;
0030 uint32_t MaxInlinePoisoningSize = 64;
0031 bool InsertVersionCheck = true;
0032 };
0033
0034
0035
0036
0037
0038
0039 class AddressSanitizerPass : public PassInfoMixin<AddressSanitizerPass> {
0040 public:
0041 AddressSanitizerPass(const AddressSanitizerOptions &Options,
0042 bool UseGlobalGC = true, bool UseOdrIndicator = true,
0043 AsanDtorKind DestructorKind = AsanDtorKind::Global,
0044 AsanCtorKind ConstructorKind = AsanCtorKind::Global);
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 AddressSanitizerOptions Options;
0052 bool UseGlobalGC;
0053 bool UseOdrIndicator;
0054 AsanDtorKind DestructorKind;
0055 AsanCtorKind ConstructorKind;
0056 };
0057
0058 struct ASanAccessInfo {
0059 const int32_t Packed;
0060 const uint8_t AccessSizeIndex;
0061 const bool IsWrite;
0062 const bool CompileKernel;
0063
0064 explicit ASanAccessInfo(int32_t Packed);
0065 ASanAccessInfo(bool IsWrite, bool CompileKernel, uint8_t AccessSizeIndex);
0066 };
0067
0068 }
0069
0070 #endif