- A bash script to build the LLVM libc++ with memory sanitizer instrumentation
- A bash script to be sourced in order to use the instrumented libc++
- build the instrumented libc++:
export CC=clang
export CXX=clang++
./build.shfeel free to change CC and CXX with you favorite clang version
- load the environment to make clang use the instrumented libc++:
source load-environmentNow you are ready to go. You can compile your program using the memory sanitizer. E.g.
$CXX -stdlib=libc++ -fsanitize=memory test.cpp -o testImportant: don't forget to pass -stdlib=libc++. Otherwise clang might use the GNU libstdc++ (default on Linux).