[clang] [lldb] [lldb] Support arm64e C++ vtable pointer signing (PR #187611)
Anatoly Trosinenko via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 20 05:12:32 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>()) {
----------------
atrosinenko wrote:
Merely thinking out loud: I'm not super familiar with all that AST stuff and thus had to consult the documentation of `AsmLabelAttr` - and it turned out, there were already made some adjustments to this attribute in the past to interact better with LLDB: f6bc251274f39dee5d09f668a56922c88bd027d8. Now I wonder if this can be reused somehow...
https://github.com/llvm/llvm-project/pull/187611
More information about the cfe-commits
mailing list