Undocumented Xcode Sanitizer Settings
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.
1 Comment
Stay up-to-date by subscribing to the Comments RSS Feed for this post.
While it is great to have Xcode build settings to enable sanitizer, all theses options can be as easily be enabled using additional compiler flags. So if you are afraid the build settings may change in the futur, just read the clang doc and use the corresponding flags.