[PATCH] D29786: Use pthreads to manage thread-local storage on darwin for leak sanitizer

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 10 14:57:01 PST 2017


kubamracek added inline comments.


================
Comment at: lib/lsan/lsan_common_mac.cc:29
+static void make_tls_key() {
+  pthread_key_create(&key, NULL);
+}
----------------
Check return value.


================
Comment at: lib/lsan/lsan_common_mac.cc:35
+
+  int *ptr = (int *) pthread_getspecific(key);
+  if (ptr == NULL && allocate) {
----------------
clang-format please


================
Comment at: lib/lsan/lsan_common_mac.cc:53
+  ++*disable_counter;
+  pthread_setspecific(key, disable_counter);
+}
----------------
This should be called only once per thread, in `get_tls_val` above.  No need to call it whenever we update the counter.  Same below.


https://reviews.llvm.org/D29786





More information about the llvm-commits mailing list