r353999 - Fix for asan bots

Leonard Chan via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 13 17:07:48 PST 2019


Author: leonardchan
Date: Wed Feb 13 17:07:47 2019
New Revision: 353999

URL: http://llvm.org/viewvc/llvm-project?rev=353999&view=rev
Log:
Fix for asan bots

Modified:
    cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=353999&r1=353998&r2=353999&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Wed Feb 13 17:07:47 2019
@@ -1066,19 +1066,22 @@ void EmitAssemblyHelper::EmitAssemblyWit
               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) {




More information about the cfe-commits mailing list