summaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-12-11 17:14:50 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-12-11 17:14:50 +0900
commit6d42195fb29b193e3e9d8c0d1bdc6109abccf958 (patch)
treedbcd1395f248f98c1fa2bf1a7be023316ae84b5d /tasks
parent274884abe51d22aac673d37d11ebf22ce92b8d98 (diff)
downloadmruby-6d42195fb29b193e3e9d8c0d1bdc6109abccf958.tar.gz
mruby-6d42195fb29b193e3e9d8c0d1bdc6109abccf958.zip
Add `enable_sanitizer` method for clang and gcc.
The patch is created by @take_cheese in #3872
Diffstat (limited to 'tasks')
-rw-r--r--tasks/toolchains/gcc.rake8
1 files changed, 8 insertions, 0 deletions
diff --git a/tasks/toolchains/gcc.rake b/tasks/toolchains/gcc.rake
index f370c0abf..fc2e0bff3 100644
--- a/tasks/toolchains/gcc.rake
+++ b/tasks/toolchains/gcc.rake
@@ -55,4 +55,12 @@ MRuby::Toolchain.new(:gcc) do |conf, _params|
@header_search_paths
end
end
+
+ def conf.enable_sanitizer(*opts)
+ fail 'sanitizer already set' if @sanitizer_list
+
+ @sanitizer_list = opts
+ flg = "-fsanitize=#{opts.join ','}"
+ [self.cc, self.cxx, self.linker].each{|cmd| cmd.flags << flg }
+ end
end