[PATCH] D34753: [Support] - Add bad alloc error handler for handling allocation malfunctions

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 9 06:14:38 PDT 2017


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

Given that LLVM will contain calls to malloc and it may return null, I'm in favor of this. Even for users that don't install the handler, it turns an OOM crash into a fatal error. That seems good.



================
Comment at: include/llvm/Support/ErrorHandling.h:100
+void install_bad_alloc_error_handler(fatal_error_handler_t handler,
+                                   void *user_data = nullptr);
+
----------------
use clang-format to align the wrapped line


================
Comment at: lib/Support/ErrorHandling.cpp:130
+	} else {
+		report_fatal_error(Reason,GenCrashDiag);
+	}
----------------
Add a space after ','


https://reviews.llvm.org/D34753





More information about the llvm-commits mailing list