[clang] [PAC] Implement function pointer re-signing (PR #98847)
Akira Hatanaka via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 16 18:00:02 PDT 2024
================
@@ -165,6 +166,88 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) {
return ::getPointerAuthInfoForType(*this, T);
}
+static bool isZeroConstant(llvm::Value *value) {
+ if (auto ci = dyn_cast<llvm::ConstantInt>(value))
+ return ci->isZero();
+ return false;
+}
+
+static bool equalAuthPolicies(const CGPointerAuthInfo &left,
+ const CGPointerAuthInfo &right) {
+ if (left.isSigned() != right.isSigned())
+ return false;
+ assert(left.isSigned() && right.isSigned() &&
+ "should only be called with non-null auth policies");
----------------
ahatanak wrote:
I moved the assertion to the beginning of the function to make it clear that at least one side has to be signed.
https://github.com/llvm/llvm-project/pull/98847
More information about the cfe-commits
mailing list