diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-12-03 13:20:43 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-12-03 13:20:43 +0000 |
commit | 09ccf39c13cfca102deea2986f45cb908bc232fd (patch) | |
tree | 85794a5935beabec984510173331334464375438 /lib/CodeGen/BackendUtil.cpp | |
parent | ad95481b2769ad61f23afc5e2c31f11c66090657 (diff) |
Add -fsanitize=memory.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169124 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/BackendUtil.cpp')
-rw-r--r-- | lib/CodeGen/BackendUtil.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index a5cc2ea004..4fe1c80e48 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -179,6 +179,11 @@ static void addAddressSanitizerPasses(const PassManagerBuilder &Builder, PM.add(createAddressSanitizerModulePass(LangOpts.SanitizeInitOrder)); } +static void addMemorySanitizerPass(const PassManagerBuilder &Builder, + PassManagerBase &PM) { + PM.add(createMemorySanitizerPass()); +} + static void addThreadSanitizerPass(const PassManagerBuilder &Builder, PassManagerBase &PM) { PM.add(createThreadSanitizerPass()); @@ -227,6 +232,13 @@ void EmitAssemblyHelper::CreatePasses(TargetMachine *TM) { addAddressSanitizerPasses); } + if (LangOpts.SanitizeMemory) { + PMBuilder.addExtension(PassManagerBuilder::EP_OptimizerLast, + addMemorySanitizerPass); + PMBuilder.addExtension(PassManagerBuilder::EP_EnabledOnOptLevel0, + addMemorySanitizerPass); + } + if (LangOpts.SanitizeThread) { PMBuilder.addExtension(PassManagerBuilder::EP_OptimizerLast, addThreadSanitizerPass); |