Rollup merge of #90589 - durin42:llvm-14-ASO-now-struct, r=nikic

rustc_llvm: update PassWrapper for recent LLVM

Now AddressSanitizerOptions is a struct, but at least the change was
tiny.

r? `@nikic`
This commit is contained in:
Matthias Krüger 2021-11-12 19:17:28 +01:00 committed by GitHub
commit 1fe15be34c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -889,15 +889,17 @@ LLVMRustOptimizeWithNewPassManager(
OptimizerLastEPCallbacks.push_back( OptimizerLastEPCallbacks.push_back(
[SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) { [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) {
MPM.addPass(RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>()); MPM.addPass(RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>());
#if LLVM_VERSION_GE(14, 0)
AddressSanitizerOptions opts = AddressSanitizerOptions{
/*CompileKernel=*/false,
SanitizerOptions->SanitizeAddressRecover,
/*UseAfterScope=*/true,
AsanDetectStackUseAfterReturnMode::Runtime,
};
MPM.addPass(ModuleAddressSanitizerPass(opts));
#else
MPM.addPass(ModuleAddressSanitizerPass( MPM.addPass(ModuleAddressSanitizerPass(
/*CompileKernel=*/false, SanitizerOptions->SanitizeAddressRecover)); /*CompileKernel=*/false, SanitizerOptions->SanitizeAddressRecover));
#if LLVM_VERSION_GE(14, 0)
AddressSanitizerOptions opts(/*CompileKernel=*/false,
SanitizerOptions->SanitizeAddressRecover,
/*UseAfterScope=*/true,
AsanDetectStackUseAfterReturnMode::Runtime);
MPM.addPass(createModuleToFunctionPassAdaptor(AddressSanitizerPass(opts)));
#else
MPM.addPass(createModuleToFunctionPassAdaptor(AddressSanitizerPass( MPM.addPass(createModuleToFunctionPassAdaptor(AddressSanitizerPass(
/*CompileKernel=*/false, SanitizerOptions->SanitizeAddressRecover, /*CompileKernel=*/false, SanitizerOptions->SanitizeAddressRecover,
/*UseAfterScope=*/true))); /*UseAfterScope=*/true)));