[libcxx-commits] [clang] [libcxx] [CodeGen] Added '*' to internal linkage types (PR #220864)
Eli Friedman via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Oct 19 20:58:41 PDT 2026
================
@@ -3606,22 +3606,33 @@ llvm::GlobalVariable *ItaniumRTTIBuilder::GetAddrOfTypeName(
llvm::raw_svector_ostream Out(Name);
CGM.getCXXABI().getMangleContext().mangleCXXRTTIName(Ty, Out);
- // We know that the mangled name of the type starts at index 4 of the
- // mangled name of the typename, so we can just index into it in order to
- // get the mangled name of the type.
+ // RTTI type-name symbol has form "_ZTS<mangled-string>". The string stored in
+ // type_info object excludes the "_ZTS" prefix. So we skip past the first 4
+ // characters. For types that do not have externally visible Clang/C++
+ // linkage, '*' is prepended to the type-name string so that within libstdc++
+ // RTTI names compare correctly via strcmp across translation units. LLVM
+ // internal linkage marks incomplete types as internal linkage, resulting in
----------------
efriedma-quic wrote:
The "LLVM internal linkage marks incomplete types [...]" bit could be more concise. I think it basically boils down to "use the linkage of the type, not the LLVM linkage of the typeinfo".
https://github.com/llvm/llvm-project/pull/220864
More information about the libcxx-commits
mailing list