[PATCH] D35513: Don't call exit() from atexit handlers on Darwin

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 18:13:29 PDT 2017


alekseyshl added inline comments.


================
Comment at: lib/lsan/lsan_common.cc:579
 
+static bool has_errors = false;
+void SetHasReportedLeaks() { has_errors = true; }
----------------
has_reported_leaks?


================
Comment at: lib/lsan/lsan_common.cc:589
   bool have_leaks = CheckForLeaks();
-  if (!have_leaks) {
-    return;
-  }
-  if (common_flags()->exitcode) {
-    Die();
+  if (have_leaks) {
+    HandleErrors();
----------------
Why not SetHasReportedLeaks() here, for all platforms? Linux does not care. In this case we can remove SetHasReportedLeaks() altogether and the logic is a bit easier to reason about.


================
Comment at: lib/lsan/lsan_common.h:232
+bool GetHasReportedLeaks();
+void HandleErrors();
+
----------------
HandleLeaks(), maybe?

Please separate it from other two and add a comment to it.


https://reviews.llvm.org/D35513





More information about the llvm-commits mailing list