[Lldb-commits] [lldb] [LLDB][NFC] Move CPlusPlusLanguage methods used in Core/Module.cpp to a separated module to break lldb-server dependencies (PR #132274)

Dmitry Vasilyev via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 25 11:01:20 PDT 2025


slydiman wrote:

Note `-ffunction-sections -fdata-sections` are added in HandleLLVMOptions.cmake and `-Wl,--gc-sections` is added in  AddLLVM.cmake by default. But unused functions will be kept anyway if they contain linker gc roots. 
A lot of functions in CPlusPlusLanguage.cpp contain static variables like
```
  static constexpr const char *const libcxx_std_unique_ptr_regex =
      "^std::__[[:alnum:]]+::unique_ptr<.+>$";
```
or
```
lldb::TypeCategoryImplSP CPlusPlusLanguage::GetFormatters() {
  static llvm::once_flag g_initialize;
  static TypeCategoryImplSP g_category;
  ...
}
```
These functions depend on BlockPointer.cpp, BlockPointer.cpp depends on TypeSystemClang.cpp, etc.
To avoid changes that may bring the problem back, I suggest to place moved functions to a subclass.

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


More information about the lldb-commits mailing list