[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
Wed Mar 26 08:04:27 PDT 2025


slydiman wrote:

> Global variables are [banned](https://llvm.org/docs/CodingStandards.html#do-not-use-static-constructors) by the coding standards, but I wouldn't be surprised if there were still some around that cause this.

TypeSystemClang.cpp contains global `char TypeSystemClang::ID;` and its constructor is GC root.

The dependencies chain looks like Module.cpp -> CPlusPlusLanguage::ExtractContextAndIdentifier() -> CPlusPlusLanguage.cpp -> CPlusPlusLanguage::GetHardcodedSynthetics() -> BlockPointerSyntheticFrontEndCreator -> BlockPointer.cpp -> TypeSystemClang::ID

GC can remove unused CPlusPlusLanguage::GetHardcodedSynthetics(), but TypeSystemClang and its dependencies will be kept.

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


More information about the lldb-commits mailing list