}
if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
- MPM.addPass(MemorySanitizerPass({}));
- MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass({})));
+ bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+ int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+ MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+ MPM.addPass(createModuleToFunctionPassAdaptor(
+ MemorySanitizerPass({TrackOrigins, Recover, false})));
}
if (LangOpts.Sanitize.has(SanitizerKind::KernelMemory)) {
FPM.addPass(BoundsCheckingPass());
});
if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
- PB.registerPipelineStartEPCallback([](ModulePassManager &MPM) {
- MPM.addPass(MemorySanitizerPass({}));
- });
+ int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+ bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+ PB.registerPipelineStartEPCallback(
+ [TrackOrigins, Recover](ModulePassManager &MPM) {
+ MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+ });
PB.registerOptimizerLastEPCallback(
- [](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
- FPM.addPass(MemorySanitizerPass({}));
+ [TrackOrigins, Recover](FunctionPassManager &FPM,
+ PassBuilder::OptimizationLevel Level) {
+ FPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
});
}
if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {