[clang] [lldb] [lldb] Support arm64e C++ vtable pointer signing (PR #187611)
Michael Buch via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 20 05:48:18 PDT 2026
================
@@ -62,8 +63,21 @@ CodeGenModule::getPointerAuthDeclDiscriminator(GlobalDecl Declaration) {
uint16_t &EntityHash = PtrAuthDiscriminatorHashes[Declaration];
if (EntityHash == 0) {
- StringRef Name = getMangledName(Declaration);
- EntityHash = llvm::getPointerAuthStableSipHash(Name);
+ const auto *ND = cast<NamedDecl>(Declaration.getDecl());
+ // If the declaration has an AsmLabelAttr (e.g., LLDB expression evaluator
+ // attaches one to map imported decls to debuggee symbols), the asm label
+ // would be used as the mangled name, producing a wrong discriminator.
+ // Compute the real C++ mangled name instead so the discriminator matches
+ // what the original translation unit used.
+ if (ND->hasAttr<AsmLabelAttr>()) {
----------------
Michael137 wrote:
`IsLiteralLabel` was removed a few months ago.
We could check specifically for the lldb mangling prefix if we wanted to restrict it to expression evaluator functions. The prefix is already checked in ItaniumMangle.
https://github.com/llvm/llvm-project/pull/187611
More information about the cfe-commits
mailing list