This patch enables building and testing libcxx under ThreadSanitizer on OS X. CMake builds that have -DLLVM_USE_SANITIZER=Thread will automatically build libcxx with -fsanitize=thread and testing via lit then runs under TSan. There was one more typo in a python config script, but after that is fixed I verified that the TSan build works.
This diff also adds a regression test for the bug (data race) fixed in https://reviews.llvm.org/D24028. If you revert the fix, TSan will report a data race in call_once. If approved, I’ll commit the test separately.