[PATCH] D56831: [NewPM] Add -fsanitize={memory, thread} handling to clang
Philip Pfaffe via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 17 01:54:37 PST 2019
philip.pfaffe created this revision.
philip.pfaffe added reviewers: chandlerc, fedor.sergeev, vitalybuka, leonardchan.
Herald added a subscriber: bollu.
This is the missing bit to drive thread and memory sanitizers through clang using the new PassManager.
https://reviews.llvm.org/D56831
Files:
clang/lib/CodeGen/BackendUtil.cpp
Index: clang/lib/CodeGen/BackendUtil.cpp
===================================================================
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1020,6 +1020,16 @@
[](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
FPM.addPass(BoundsCheckingPass());
});
+ if (LangOpts.Sanitize.has(SanitizerKind::Memory))
+ PB.registerOptimizerLastEPCallback(
+ [](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
+ FPM.addPass(MemorySanitizerPass());
+ });
+ if (LangOpts.Sanitize.has(SanitizerKind::Thread))
+ PB.registerOptimizerLastEPCallback(
+ [](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
+ FPM.addPass(ThreadSanitizerPass());
+ });
if (Optional<GCOVOptions> Options = getGCOVOptions(CodeGenOpts))
PB.registerPipelineStartEPCallback([Options](ModulePassManager &MPM) {
MPM.addPass(GCOVProfilerPass(*Options));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56831.182222.patch
Type: text/x-patch
Size: 1065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190117/551e1c69/attachment.bin>
More information about the llvm-commits
mailing list