[llvm-branch-commits] [clang] [clang] Implement pointer authentication for C++ virtual functions, v-tables, and VTTs (PR #94056)

Anton Korobeynikov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jun 7 23:37:17 PDT 2024


================
@@ -7037,8 +7036,64 @@ void ItaniumMangleContextImpl::mangleCXXDtorComdat(const CXXDestructorDecl *D,
   Mangler.mangle(GlobalDecl(D, Dtor_Comdat));
 }
 
+static void mangleOverrideDiscrimination(CXXNameMangler &mangler,
+                                         ASTContext &context,
+                                         const ThunkInfo &thunk) {
+  auto &langOpts = context.getLangOpts();
+  auto thisType = thunk.ThisType;
+  auto thisRecord = thisType->getPointeeCXXRecordDecl();
+  auto ptrauthClassRecord = context.baseForVTableAuthentication(thisRecord);
+  unsigned typedDiscriminator =
+      context.getPointerAuthVTablePointerDiscriminator(thisRecord);
+  mangler.mangleVendorQualifier("__vtptrauth");
+  auto &manglerStream = mangler.getStream();
+  manglerStream << "I";
+  if (auto explicitAuth =
+          ptrauthClassRecord->getAttr<VTablePointerAuthenticationAttr>()) {
+    manglerStream << "Lj" << explicitAuth->getKey();
----------------
asl wrote:

Do we have mangling bits documented somewhere?

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


More information about the llvm-branch-commits mailing list