[Lldb-commits] [PATCH] D23830: Add cmake option to choose whether to use the builtin demangler

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 24 03:54:23 PDT 2016


labath created this revision.
labath added reviewers: zturner, emaste, krytarowski.
labath added subscribers: lldb-commits, clayborg.
Herald added a subscriber: emaste.

Previously the builting demangler was on for platforms that explicitly set a flag by modifying
Mangled.cpp (windows, freebsd). The Xcode build always used builtin demangler by passing a
compiler flag. This adds a cmake flag (defaulting to ON) to configure the demangling library used
at build time. The flag is only available on non-windows platforms as there the system demangler
is not present (in the form we're trying to use it, at least).
The impact of this change is:
- linux: switches to the builtin demangler
- freebsd, windows: NFC (I hope)
- netbsd: switches to the builtin demangler
- osx cmake build: switches to the builtin demangler (matching the XCode build)

The main motivation for this is the cross-platform case, where it should bring more consistency
by removing the dependency on the host demangler (which can be completely unrelated to the debug
target).

https://reviews.llvm.org/D23830

Files:
  cmake/modules/LLDBConfig.cmake
  source/Core/Mangled.cpp

Index: source/Core/Mangled.cpp
===================================================================
--- source/Core/Mangled.cpp
+++ source/Core/Mangled.cpp
@@ -14,20 +14,15 @@
 #include "lldb/Host/windows/windows.h"
 #include <Dbghelp.h>
 #pragma comment(lib, "dbghelp.lib")
-#define LLDB_USE_BUILTIN_DEMANGLER
-#elif defined (__FreeBSD__)
-#define LLDB_USE_BUILTIN_DEMANGLER
-#else
-#include <cxxabi.h>
 #endif
 
 #ifdef LLDB_USE_BUILTIN_DEMANGLER
-
 // Provide a fast-path demangler implemented in FastDemangle.cpp until it can
 // replace the existing C++ demangler with a complete implementation
 #include "lldb/Core/FastDemangle.h"
 #include "lldb/Core/CxaDemangle.h"
-
+#else
+#include <cxxabi.h>
 #endif
 
 
Index: cmake/modules/LLDBConfig.cmake
===================================================================
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -401,3 +401,12 @@
             "- ignore this warning and accept occasional instability")
     endif()
 endif()
+
+if(MSVC)
+    set(LLDB_USE_BUILTIN_DEMANGLER ON)
+else()
+    option(LLDB_USE_BUILTIN_DEMANGLER "Use lldb's builtin demangler instead of the system one" ON)
+endif()
+if(LLDB_USE_BUILTIN_DEMANGLER)
+    add_definitions(-DLLDB_USE_BUILTIN_DEMANGLER)
+endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23830.69093.patch
Type: text/x-patch
Size: 1266 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160824/22227cf5/attachment.bin>


More information about the lldb-commits mailing list