Here’s what I gobbled together based on Google; mostly thanks to WebKit being open source. (I only tested CLANG_ADDRESS_SANITIZER so far, but based on Google the other flags should work as well).
There are also CLANG_THREAD_SANITIZER
and CLANG_MEMORY_SANITIZER
. The address sanitizer seems most useful, though:
Since this flag is undocumented it might change without warning, and there are some hints that this might be renamed to
ENABLE_ADDRESS_SANITIZER
.Using this flag makes it simpler to dynamically switch this on or off without having to create a separate Xcode configuration that would be much harder to maintain, and you can configure your CI to run tests both with and without ASan to both have a great assurance of memory correctness and testing the binary that you actually ship to customers.