diff options
author | Leonard Chan <leonardchan@google.com> | 2019-02-20 03:50:11 +0000 |
---|---|---|
committer | Leonard Chan <leonardchan@google.com> | 2019-02-20 03:50:11 +0000 |
commit | 1a240ed25d68143921fdbd870e794195c414e7bd (patch) | |
tree | 513a510b38e8ff3084c0bf8a87f294bdac4b16ad /clang/lib/CodeGen/BackendUtil.cpp | |
parent | 303217e8b43d4d299aeb629ecb5b1e060fc77969 (diff) | |
download | bcm5719-llvm-1a240ed25d68143921fdbd870e794195c414e7bd.tar.gz bcm5719-llvm-1a240ed25d68143921fdbd870e794195c414e7bd.zip |
[NewPM] Add other sanitizers at O0
This allows for MSan and TSan to be used without optimizations required.
Differential Revision: https://reviews.llvm.org/D58424
llvm-svn: 354431
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index d86e24ff2dd..8f9ea093c96 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -932,6 +932,14 @@ void addSanitizersAtO0(ModulePassManager &MPM, const Triple &TargetTriple, /*CompileKernel=*/false, Recover, ModuleUseAfterScope, CodeGenOpts.SanitizeAddressUseOdrIndicator)); } + + if (LangOpts.Sanitize.has(SanitizerKind::Memory)) { + MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass({}))); + } + + if (LangOpts.Sanitize.has(SanitizerKind::Thread)) { + MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass())); + } } /// A clean version of `EmitAssembly` that uses the new pass manager. |