]> granicus.if.org Git - clang/commitdiff
Fix for asan bots
authorLeonard Chan <leonardchan@google.com>
Thu, 14 Feb 2019 01:07:47 +0000 (01:07 +0000)
committerLeonard Chan <leonardchan@google.com>
Thu, 14 Feb 2019 01:07:47 +0000 (01:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353999 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/BackendUtil.cpp

index 633c0dfb666decd452824972c467160fa642993f..d86e24ff2dd35918d40df10d766676856490e18e 100644 (file)
@@ -1066,19 +1066,22 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
               RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>());
         });
         bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Address);
+        bool UseAfterScope = CodeGenOpts.SanitizeAddressUseAfterScope;
         PB.registerOptimizerLastEPCallback(
-            [&](FunctionPassManager &FPM,
-                PassBuilder::OptimizationLevel Level) {
+            [Recover, UseAfterScope](FunctionPassManager &FPM,
+                                     PassBuilder::OptimizationLevel Level) {
               FPM.addPass(AddressSanitizerPass(
-                  /*CompileKernel=*/false, Recover,
-                  CodeGenOpts.SanitizeAddressUseAfterScope));
+                  /*CompileKernel=*/false, Recover, UseAfterScope));
             });
         bool ModuleUseAfterScope = asanUseGlobalsGC(TargetTriple, CodeGenOpts);
-        PB.registerPipelineStartEPCallback([&](ModulePassManager &MPM) {
-          MPM.addPass(ModuleAddressSanitizerPass(
-              /*CompileKernel=*/false, Recover, ModuleUseAfterScope,
-              CodeGenOpts.SanitizeAddressUseOdrIndicator));
-        });
+        bool UseOdrIndicator = CodeGenOpts.SanitizeAddressUseOdrIndicator;
+        PB.registerPipelineStartEPCallback(
+            [Recover, ModuleUseAfterScope,
+             UseOdrIndicator](ModulePassManager &MPM) {
+              MPM.addPass(ModuleAddressSanitizerPass(
+                  /*CompileKernel=*/false, Recover, ModuleUseAfterScope,
+                  UseOdrIndicator));
+            });
       }
       if (Optional<GCOVOptions> Options = getGCOVOptions(CodeGenOpts))
         PB.registerPipelineStartEPCallback([Options](ModulePassManager &MPM) {