[libcxx-commits] [libcxxabi] [libc++abi] Introduce LIBCXXABI_ENABLE_DEMANGLER (PR #72948)

Michael Kenzel via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 20 19:36:16 PST 2023


https://github.com/michael-kenzel updated https://github.com/llvm/llvm-project/pull/72948

>From dd800fc5659849f69ca3387aacc728158eadf948 Mon Sep 17 00:00:00 2001
From: Michael Kenzel <michael.kenzel at gmail.com>
Date: Tue, 21 Nov 2023 04:19:00 +0100
Subject: [PATCH] [libc++abi] Introduce LIBCXXABI_ENABLE_DEMANGLER

---
 libcxxabi/CMakeLists.txt     | 5 ++++-
 libcxxabi/src/CMakeLists.txt | 7 ++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index efe830bd2ad6659..88f74925a2b0104 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -40,6 +40,9 @@ include(CMakeDependentOption)
 include(HandleCompilerRT)
 
 # Define options.
+option(LIBCXXABI_ENABLE_DEMANGLER
+  "Provide support for demangling in the runtime.
+   When disabled, libc++abi does not support the name demangler API." ON)
 option(LIBCXXABI_ENABLE_EXCEPTIONS
   "Provide support for exceptions in the runtime.
   When disabled, libc++abi does not support stack unwinding and other exceptions-related features." ON)
@@ -385,7 +388,7 @@ if (LIBCXXABI_SILENT_TERMINATE)
   add_definitions(-DLIBCXXABI_SILENT_TERMINATE)
 endif()
 
-if (LIBCXXABI_NON_DEMANGLING_TERMINATE)
+if (LIBCXXABI_NON_DEMANGLING_TERMINATE OR NOT LIBCXXABI_ENABLE_DEMANGLER)
   add_definitions(-DLIBCXXABI_NON_DEMANGLING_TERMINATE)
 endif()
 
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 02031b69fd9156a..4f9e7a0026bb703 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -3,7 +3,6 @@ set(LIBCXXABI_SOURCES
   # C++ABI files
   cxa_aux_runtime.cpp
   cxa_default_handlers.cpp
-  cxa_demangle.cpp
   cxa_exception_storage.cpp
   cxa_guard.cpp
   cxa_handlers.cpp
@@ -19,6 +18,12 @@ set(LIBCXXABI_SOURCES
   private_typeinfo.cpp
 )
 
+if (LIBCXXABI_ENABLE_DEMANGLER)
+  list(APPEND LIBCXXABI_SOURCES
+    cxa_demangle.cpp
+  )
+endif()
+
 if (LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS)
   list(APPEND LIBCXXABI_SOURCES
     stdlib_new_delete.cpp



More information about the libcxx-commits mailing list