[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:35:02 PDT 2024
================
@@ -3088,6 +3089,17 @@ QualType ASTContext::removeAddrSpaceQualType(QualType T) const {
return QualType(TypeNode, Quals.getFastQualifiers());
}
+uint16_t ASTContext::getPointerAuthVTablePointerDiscriminator(
+ const CXXRecordDecl *record) {
+ assert(record->isPolymorphic() &&
+ "Attempted to get vtable pointer discriminator on a monomorphic type");
+ std::unique_ptr<MangleContext> MC(createMangleContext());
+ SmallString<256> Str;
+ llvm::raw_svector_ostream Out(Str);
+ MC->mangleCXXVTable(record, Out);
+ return llvm::getPointerAuthStableSipHash16(Str.c_str());
----------------
asl wrote:
```suggestion
return llvm::getPointerAuthStableSipHash16(Str.str());
```
https://github.com/llvm/llvm-project/pull/94056
More information about the llvm-branch-commits
mailing list