CLion
 
Get CLion
You are viewing the documentation for an earlier version of CLion.

Google sanitizers

Last modified: 08 April 2022

OS: Linux / Windows 10 with clang-cl (AddressSanitizer only) or WSL / macOS (AddressSanitizer, ThreadSanitizer, and UndefinedBehaviorSanitizer)

Project format: CMake (full support) / Makefile and compilation database (no output visualization)

Toolchain: local / remote/WSL/Docker

Sanitizers are open-source tools for dynamic code analysis designed by Google. CLion integrates with the following Sanitizers:

  • AddressSanitizer (ASan)

  • LeakSanitizer (LSan)

  • ThreadSanitizer (TSan)

  • UndefinedBehaviorSanitizer (UBSsan)

  • MemorySanitizer (MSan)

Sanitizers are implemented in Clang starting 3.1 and GCC starting 4.8. All the sanitizers are available on Linux x86_64 machines. You can use AddressSanitizer on Windows 10 with clang-cl under the MSVC toolchain. For macOS, the supported sanitizers are AddressSanitizer, ThreadSanitizer, and UndefinedBehaviorSanitizer.

As Sanitizers are based on compiler instrumentation, you need to rebuild your project in order to start using these tools.