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

Mitch Phillips via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 00:25:26 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) {
----------------
hctim wrote:

Original patch also renamed `Check` to `check`, but that was asked to be separated out by Vitaly. I'll make that change as well after this one. It should be `check` for LLVM standards.

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


More information about the llvm-commits mailing list