[libcxx-commits] [libcxxabi] 74d49b2 - [libcxxabi] define _LIBCPP_VERBOSE_ABORT

Nick Desaulniers via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 17 09:43:05 PDT 2023


Author: Nick Desaulniers
Date: 2023-05-17T09:42:35-07:00
New Revision: 74d49b203c95a1fcb59fdc57b6ab3ce1d4b91491

URL: https://github.com/llvm/llvm-project/commit/74d49b203c95a1fcb59fdc57b6ab3ce1d4b91491
DIFF: https://github.com/llvm/llvm-project/commit/74d49b203c95a1fcb59fdc57b6ab3ce1d4b91491.diff

LOG: [libcxxabi] define _LIBCPP_VERBOSE_ABORT

libc++ may be built with or without assertions. This causes definitions
of various methods of std::string_view to contain assertions and calls
to __libcpp_verbose_abort which libcxxabi does not provide. libcxxabi
does provide abort_message with the same interface, so define
_LIBCPP_VERBOSE_ABORT to use that. Otherwise D148566 will trigger
linkage failures for the missing symbol __libcpp_verbose_abort.

Link: https://libcxx.llvm.org/UsingLibcxx.html#enabling-the-safe-libc-mode

Reviewed By: #libc_abi, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D149092

Added: 
    

Modified: 
    libcxxabi/src/cxa_demangle.cpp
    libcxxabi/src/demangle/DemangleConfig.h

Removed: 
    


################################################################################
diff  --git a/libcxxabi/src/cxa_demangle.cpp b/libcxxabi/src/cxa_demangle.cpp
index 7baac680074ce..0616031eee53a 100644
--- a/libcxxabi/src/cxa_demangle.cpp
+++ b/libcxxabi/src/cxa_demangle.cpp
@@ -10,6 +10,7 @@
 // file does not yet support:
 //   - C++ modules TS
 
+#include "demangle/DemangleConfig.h"
 #include "demangle/ItaniumDemangle.h"
 #include "__cxxabi_config.h"
 #include <cassert>

diff  --git a/libcxxabi/src/demangle/DemangleConfig.h b/libcxxabi/src/demangle/DemangleConfig.h
index 9d818535b0942..5ae933c033d52 100644
--- a/libcxxabi/src/demangle/DemangleConfig.h
+++ b/libcxxabi/src/demangle/DemangleConfig.h
@@ -11,6 +11,11 @@
 #ifndef LIBCXXABI_DEMANGLE_DEMANGLE_CONFIG_H
 #define LIBCXXABI_DEMANGLE_DEMANGLE_CONFIG_H
 
+// Must be defined before pulling in headers from libc++.
+// https://libcxx.llvm.org/UsingLibcxx.html#enabling-the-safe-libc-mode
+#define _LIBCPP_VERBOSE_ABORT(...) abort_message(__VA_ARGS__)
+
+#include "../abort_message.h"
 #include <ciso646>
 
 #ifdef _MSC_VER


        


More information about the libcxx-commits mailing list