@@ -580,10 +580,10 @@ char ASanGlobalsMetadataWrapperPass::ID = 0;
580
580
581
581
// / AddressSanitizer: instrument the code in module to find memory bugs.
582
582
struct AddressSanitizer {
583
- AddressSanitizer (Module &M, GlobalsMetadata & GlobalsMD,
583
+ AddressSanitizer (Module &M, const GlobalsMetadata * GlobalsMD,
584
584
bool CompileKernel = false , bool Recover = false ,
585
585
bool UseAfterScope = false )
586
- : UseAfterScope(UseAfterScope || ClUseAfterScope), GlobalsMD(GlobalsMD) {
586
+ : UseAfterScope(UseAfterScope || ClUseAfterScope), GlobalsMD(* GlobalsMD) {
587
587
this ->Recover = ClRecover.getNumOccurrences () > 0 ? ClRecover : Recover;
588
588
this ->CompileKernel =
589
589
ClEnableKasan.getNumOccurrences () > 0 ? ClEnableKasan : CompileKernel;
@@ -722,7 +722,7 @@ class AddressSanitizerLegacyPass : public FunctionPass {
722
722
getAnalysis<ASanGlobalsMetadataWrapperPass>().getGlobalsMD ();
723
723
const TargetLibraryInfo *TLI =
724
724
&getAnalysis<TargetLibraryInfoWrapperPass>().getTLI (F);
725
- AddressSanitizer ASan (*F.getParent (), GlobalsMD, CompileKernel, Recover,
725
+ AddressSanitizer ASan (*F.getParent (), & GlobalsMD, CompileKernel, Recover,
726
726
UseAfterScope);
727
727
return ASan.instrumentFunction (F, TLI);
728
728
}
@@ -735,10 +735,10 @@ class AddressSanitizerLegacyPass : public FunctionPass {
735
735
736
736
class ModuleAddressSanitizer {
737
737
public:
738
- ModuleAddressSanitizer (Module &M, GlobalsMetadata & GlobalsMD,
738
+ ModuleAddressSanitizer (Module &M, const GlobalsMetadata * GlobalsMD,
739
739
bool CompileKernel = false , bool Recover = false ,
740
740
bool UseGlobalsGC = true , bool UseOdrIndicator = false )
741
- : GlobalsMD(GlobalsMD), UseGlobalsGC(UseGlobalsGC && ClUseGlobalsGC),
741
+ : GlobalsMD(* GlobalsMD), UseGlobalsGC(UseGlobalsGC && ClUseGlobalsGC),
742
742
// Enable aliases as they should have no downside with ODR indicators.
743
743
UsePrivateAlias (UseOdrIndicator || ClUsePrivateAlias),
744
744
UseOdrIndicator(UseOdrIndicator || ClUseOdrIndicator),
@@ -845,7 +845,7 @@ class ModuleAddressSanitizerLegacyPass : public ModulePass {
845
845
bool runOnModule (Module &M) override {
846
846
GlobalsMetadata &GlobalsMD =
847
847
getAnalysis<ASanGlobalsMetadataWrapperPass>().getGlobalsMD ();
848
- ModuleAddressSanitizer ASanModule (M, GlobalsMD, CompileKernel, Recover,
848
+ ModuleAddressSanitizer ASanModule (M, & GlobalsMD, CompileKernel, Recover,
849
849
UseGlobalGC, UseOdrIndicator);
850
850
return ASanModule.instrumentModule (M);
851
851
}
@@ -1171,7 +1171,7 @@ PreservedAnalyses AddressSanitizerPass::run(Function &F,
1171
1171
Module &M = *F.getParent ();
1172
1172
if (auto *R = MAM.getCachedResult <ASanGlobalsMetadataAnalysis>(M)) {
1173
1173
const TargetLibraryInfo *TLI = &AM.getResult <TargetLibraryAnalysis>(F);
1174
- AddressSanitizer Sanitizer (M, * R, CompileKernel, Recover, UseAfterScope);
1174
+ AddressSanitizer Sanitizer (M, R, CompileKernel, Recover, UseAfterScope);
1175
1175
if (Sanitizer.instrumentFunction (F, TLI))
1176
1176
return PreservedAnalyses::none ();
1177
1177
return PreservedAnalyses::all ();
@@ -1193,7 +1193,7 @@ ModuleAddressSanitizerPass::ModuleAddressSanitizerPass(bool CompileKernel,
1193
1193
PreservedAnalyses ModuleAddressSanitizerPass::run (Module &M,
1194
1194
AnalysisManager<Module> &AM) {
1195
1195
GlobalsMetadata &GlobalsMD = AM.getResult <ASanGlobalsMetadataAnalysis>(M);
1196
- ModuleAddressSanitizer Sanitizer (M, GlobalsMD, CompileKernel, Recover,
1196
+ ModuleAddressSanitizer Sanitizer (M, & GlobalsMD, CompileKernel, Recover,
1197
1197
UseGlobalGC, UseOdrIndicator);
1198
1198
if (Sanitizer.instrumentModule (M))
1199
1199
return PreservedAnalyses::none ();
0 commit comments