[compiler-rt] Log errno (or fuchsia equivalent) on map failures (PR #95391)

Fabio D'Urso via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 08:33:18 PDT 2024


================
@@ -12,17 +12,28 @@
 #include "gwp_asan/definitions.h"
 
 #include <stddef.h>
+#include <stdint.h>
 
 namespace gwp_asan {
 // Terminates in a platform-specific way with `Message`.
 void die(const char *Message);
+void dieWithErrorCode(const char *Message, int64_t ErrorCode);
 
 // Checks that `Condition` is true, otherwise dies with `Message`.
 GWP_ASAN_ALWAYS_INLINE void Check(bool Condition, const char *Message) {
-  if (Condition)
+  if (GWP_ASAN_LIKELY(Condition))
     return;
   die(Message);
 }
+
+// Checks that `Condition` is true, otherwise dies with `Message` (including
+// errno at the end).
+GWP_ASAN_ALWAYS_INLINE void
+checkWithErrorCode(bool Condition, const char *Message, int64_t ErrorCode) {
----------------
fabio-d wrote:

(nit) Is it on purpose that `Check` has a capital-case initial letter and `checkWithErrorCode` doesn't?

https://github.com/llvm/llvm-project/pull/95391


More information about the llvm-commits mailing list